-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed reset password for code #4
base: main
Are you sure you want to change the base?
Conversation
@@ -276,7 +296,19 @@ protected virtual async Task<string> GenerateCodeAsync(string phoneNumber, Verif | |||
switch (type) | |||
{ | |||
case VerificationCodeType.ResetPassword: | |||
code = await _identityUserManager.GeneratePasswordResetTokenAsync(identityUser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use ASP.NET Core's IdentityUserManager.GeneratePasswordResetTokenAsync();
? The default implementation of IUserTwoFactorTokenProvider is fine and EasyAbp also provides one: https://github.com/EasyAbp/Abp.VerificationCode/blob/master/src/EasyAbp.Abp.VerificationCode.Identity/EasyAbp/Abp/VerificationCode/Identity/AbpVerificationCodeTokenProvider.cs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GeneratePasswordResetTokenAsync() this method generate code length too long , the sms not allow code longer than 24 in aliyun .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can replece the default implementation, see https://github.com/EasyAbp/Abp.VerificationCode/blob/master/src/EasyAbp.Abp.VerificationCode.Identity/EasyAbp/Abp/VerificationCode/Identity/AbpVerificationCodeTokenProvider.cs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the Abp.VerficationCode not implement twoFactor methods yet . I need to take time to fix that repository ,wait some days please when i have time .
@@ -276,7 +296,19 @@ protected virtual async Task<string> GenerateCodeAsync(string phoneNumber, Verif | |||
switch (type) | |||
{ | |||
case VerificationCodeType.ResetPassword: | |||
code = await _identityUserManager.GeneratePasswordResetTokenAsync(identityUser); | |||
if (identityUser == null) | |||
throw new UserFriendlyException(_localizer["InvalidPhoneNumber"]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about throw new InvalidVerificationCodeException();
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if u used twofactor to generate , u need use identityuser not null , identityuser come from phonenumber in database. database doesn`t have this phonenumber u cant resetpassword.
improve reset password use phone and code use TwoFactor way in generate code and verify code