public virtual async Task <IActionResult> OnPostAsync() { try { ValidateModel(); await AccountAppService.ResetPasswordAsync( new ResetPasswordDto { UserId = UserId, ResetToken = ResetToken, Password = Password } ); } catch (Exception e) { var message = GetMessageFromException(e); MyAlerts.Warning(message, L["OperationFailed"]); return(await OnGetAsync()); } //TODO: Try to automatically login! return(RedirectToPage("./ResetPasswordConfirmation", new { returnUrl = ReturnUrl, returnUrlHash = ReturnUrlHash })); }
public virtual async Task <IActionResult> OnPostAsync() { ValidateModel(); try { await AccountAppService.ResetPasswordAsync( new ResetPasswordDto { UserId = UserId, ResetToken = ResetToken, Password = Password } ); } catch (AbpIdentityResultException e) { if (!string.IsNullOrWhiteSpace(e.Message)) { Alerts.Warning(GetLocalizeExceptionMessage(e)); return(Page()); } throw; } //TODO: Try to automatically login! return(RedirectToPage("./ResetPasswordConfirmation", new { returnUrl = ReturnUrl, returnUrlHash = ReturnUrlHash })); }
public async Task <IActionResult> ResetPassword([FromBody] ResetPasswordDTO model) { if (ModelState.IsValid) { var result = await _accountAppService.ResetPasswordAsync(model); if (result) { _generalAppService.CommitTransaction(); return(Ok(new Response { Message = "your passwored has been changed" })); } return(BadRequest(new Response { Message = "an error occur" })); } return(BadRequest("Some properties are not valid")); }