public ActionResult Confirm(string id) { var vm = new ChangePasswordFromResetKeyInputModel() { Key = id }; return View("Confirm", vm); }
public ActionResult Confirm(ChangePasswordFromResetKeyInputModel model) { if (ModelState.IsValid) { try { CustomUser account; if (this.userAccountService.ChangePasswordFromResetKey(model.Key, model.Password, out account)) { if (account.IsLoginAllowed && !account.IsAccountClosed) { this.authenticationService.SignIn(account); if (account.RequiresTwoFactorAuthCodeToSignIn()) { return RedirectToAction("TwoFactorAuthCodeLogin", "Login"); } if (account.RequiresTwoFactorCertificateToSignIn()) { return RedirectToAction("CertificateLogin", "Login"); } } return RedirectToAction("Success"); } else { ModelState.AddModelError("", "Error changing password. The key might be invalid."); } } catch (ValidationException ex) { ModelState.AddModelError("", ex.Message); } } return View(); }