Is there an email confirmation expiration on the confirmation link that is sent out? If so is there a way to change it?
5 Answer(s)
-
0
There is currently no validation for the validity period, simply comparing EmailConfirmationCode.
But asp net identity has its own token expiration time validation.
So we can consider increasing the expiration date of the confirmation phone and email, changing the password and so on.
-
0
Sorry, I am a little confused. Are you saying the confirmation email that is sent out has an expiration?
-
0
asp net identity [https://www.asp.net/identity]) has this feature(Zero also integrates asp net identity), but currently there is no such feature in zero.
-
0
hi joe704la
If you want to implement this feature as soon as possible, You can override Abp.SetNewEmailConfirmationCode by yourself. Customize EmailConfirmationCode and add a timestamp (note that the length should not exceed 328)
Then perform custom validation in AccountAppService.ActivateEmail.
I provide an implementation, but you can customize the way you like.
The DataProtectorTokenProvider uses the TokenLifespan property of the DataProtectionTokenProviderOptions by default to validate the validity period. The default is 1 day.
Of course, DataProtectionTokenProviderOptions can be customized, please refer to:[https://github.com/aspnet/Docs/issues/5436])
//Generate email code var user = await _userManager.FindByIdAsync("3"); var emailCode = await _dataProtectorTokenProvider.GenerateAsync("ActivateEmail", _userManager, user); //emailCode like CfDJ8BgfrGEzWk9Chdg/C6u19QLFGUhjSSZs12yz/guCxJDzbNUe2vBxSK8OK9gyS+7wDHAt3MYV1tMKEWA0ysONLPBJfyC9qLFbNGxi3S32c6I3vsmCRMOFmTSPoISBIPAHaNgt3lLd76mxxw9Gu4dWraNdhZgOF3GcbdH5namG2ld4YBULmFjwB9WkHMqVXS/V9A== // send email //Validate if (await _dataProtectorTokenProvider.ValidateAsync("ActivateEmail", emailCode, _userManager, user)) { //Activate success! } else { //Activate fail. }
-
0
<cite>joe704la: </cite> Is there an email confirmation expiration on the confirmation link that is sent out? If so is there a way to change it?
there's no expiration time for the email confirmation. If you want to implement such a feature you can follow @maliming's suggestion.