-
-
Save Pownraj-2818/cb8ce2041d4f9474e275cdc13b9dc799 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task ResetPassword(ResetPasswordRequest request) | |
{ | |
var account = GetuserByOtp(request.Otp); | |
if (account == null || account.OTPExpiresAt < DateTime.Now) | |
{ | |
throw new BadHttpRequestException("Invalid OTP"); | |
} | |
account.PasswordHash = BCrypt.Net.BCrypt.HashPassword(request.Password); | |
account.PasswordResetAt = DateTime.Now; | |
account.OTP = null; | |
account.OTPExpiresAt = DateTime.MinValue; | |
_context.Users.Update(account); | |
await _context.SaveChangesAsync(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment