public ActionResult Confirm(ChangePasswordFromResetKeyInputModel model) { if (ModelState.IsValid) { try { HierarchicalUserAccount account; if (this.userAccountService.ChangePasswordFromResetKey(model.Key, model.Password, out account)) { 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()); }
public ActionResult Confirm(string id) { var vm = new ChangePasswordFromResetKeyInputModel() { Key = id }; return(View("Confirm", vm)); }
public ActionResult Confirm(ChangePasswordFromResetKeyInputModel model) { if (ModelState.IsValid) { try { if (this.userAccountService.ChangePasswordFromResetKey(model.Key, model.Password)) { return(View("Success")); } else { ModelState.AddModelError("", "Error changing password. The key might be invalid."); } } catch (ValidationException ex) { ModelState.AddModelError("", ex.Message); } } return(View()); }
public ActionResult Confirm(ChangePasswordFromResetKeyInputModel model) { if (ModelState.IsValid) { try { BrockAllen.MembershipReboot.UserAccount account; if (this.userAccountService.ChangePasswordFromResetKey(model.Key, model.Password, out account)) { AuthenticationFailureCode failureCode; this.userAccountService.Authenticate(this.userAccountService.Configuration.DefaultTenant, account.Username, model.Password, out account, out failureCode); if (failureCode == AuthenticationFailureCode.None) { 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()); }
public ActionResult Confirm(ChangePasswordFromResetKeyInputModel model) { if (!ModelState.IsValid) { return(View()); } try { HierarchicalUserAccount account; if (_userAccountService.ChangePasswordFromResetKey(model.Key, model.Password, out account)) { return(RedirectToAction("Success")); } ModelState.AddModelError("", "Error changing password. The key might be invalid."); } catch (ValidationException ex) { ModelState.AddModelError("", ex.Message); } return(View()); }