public async Task <Result> ResetPasswordAsync(PasswordRecoveryInfo userInfo, CancellationToken cancellationToken = default) { var user = await _userManager.FindByIdAsync(userInfo.UserId); if (user == null) { return(Result.Fail(ExceptionConstants.USER_WAS_NOT_FOUND)); } var decodedTokenBytes = Convert.FromBase64String(userInfo.Token); string decodedTokenString = Encoding.UTF8.GetString(decodedTokenBytes); var result = await _userManager.ResetPasswordAsync(user, decodedTokenString, userInfo.Password); if (result.Succeeded) { return(await _emailBuilder.SendEmailWithLinkAsync(user.Email, EmailConstants.PASSWORD_RESET_SUBJECT, EmailConstants.PASSWORD_RESET_LINK, EmailConstants.PASSWORD_RESET_MESSAGE, userInfo.CallBackUrl, cancellationToken)); } else { return(Result.Fail(result.Errors.Select(x => x.Description).Join("\n"))); } }