c# - asp.net identity SetEmailConfirmedAsync -
c# - asp.net identity SetEmailConfirmedAsync -
i'm having issues setemailconfirmedasync method within userstore class.
everything working fine, users beingness created hashed password, tokens beingness generated confirmation email, email sending successfully. problem comes when seek verify email
public async task<actionresult> confirmemail(guid userid, string token) { task<microsoft.aspnet.identity.identityresult> result = usermanager.confirmemailasync(userid, token); if (result.result.succeeded) { } else { } homecoming view(); }
this calls
public task setemailconfirmedasync(user user, bool confirmed) { accountservice.verifiyaccount(user.id, confirmed); homecoming task.fromresult(0); }
which sets business relationship verified i'd expect. however, next thing happens findbynameasync called followed updateasync method overwirtes changes applied within setemailconfirmedasync.
does know why asp.net identity makes phone call updateasync after setemailconfirmedasync? i've searched around clues cant find anything.
update
i've done digging , pulled identity source code
public virtual async task<identityresult> confirmemailasync(tkey userid, string token) { throwifdisposed(); var store = getemailstore(); var user = await findbyidasync(userid).withcurrentculture(); if (user == null) { throw new invalidoperationexception(string.format(cultureinfo.currentculture, resources.useridnotfound, userid)); } if (!await verifyusertokenasync(userid, "confirmation", token).withcurrentculture()) { homecoming identityresult.failed(resources.invalidtoken); } await store.setemailconfirmedasync(user, true).withcurrentculture(); homecoming await updateasync(user).withcurrentculture(); }
i'm struggling figure out why phone call update user made after setemailconfirmedasync has been called
dunno version of identity using, current version calls method:
public virtual task setemailconfirmedasync(tuser user, bool confirmed) { throwifdisposed(); if (user == null) { throw new argumentnullexception("user"); } user.emailconfirmed = confirmed; homecoming task.fromresult(0); }
as can see, sets user e-mail confirmed, needs save changes database, the
return await updateasync(user).withcurrentculture();
c# asp.net asp.net-mvc asp.net-identity
Comments
Post a Comment