public virtual async Task <AuthResponse> ConfirmResetPassword(ConfirmPasswordResetRequestModel model, CancellationToken cancellationToken = default(CancellationToken)) { HttpResponseMessage httpResponse = await this.Client.PostAsJsonAsync($"api/auth/confirmpasswordreset", model, cancellationToken).ConfigureAwait(false); this.HandleResponseCode(httpResponse); return(JsonConvert.DeserializeObject <AuthResponse>(httpResponse.Content.ContentToString())); }
public virtual async Task <IActionResult> ConfirmPasswordReset([FromBody] ConfirmPasswordResetRequestModel model) { AuthResponse result = await this.authService.ConfirmPasswordReset(model); if (result.Success) { return(this.Ok(result)); } else { return(this.StatusCode(StatusCodes.Status400BadRequest, result)); } }
public async Task <AuthResponse> ConfirmPasswordReset(ConfirmPasswordResetRequestModel model) { AuthUser user = await this.userManager.FindByIdAsync(model.Id); if (user == null) { return(ValidationResponseFactory <AuthResponse> .FailureAuthResponse("User not found", AuthErrorCodes.UserDoesNotExist)); } else { IdentityResult result = await this.userManager.ResetPasswordAsync(user, System.Net.WebUtility.UrlDecode(model.Token), model.NewPassword); if (result.Succeeded) { return(ValidationResponseFactory <AuthResponse> .SuccessAuthResponse()); } else { return(ValidationResponseFactory <AuthResponse> .FailureAuthResponse(result, AuthErrorCodes.UnableToConfirmPasssordReset)); } } }