public async Task <ActionResult> PasswordSetNew(AccountPasswordRecoverResponseViewModel model) { if (ModelState.IsValid) { var adminUser = await _appUserManager.FindByEmailAsync(model.Email); if (adminUser != null && adminUser.Realms.Contains(Realm.AdminWebsite)) { var result = await _appUserManager.ResetPasswordAsync( adminUser.Id, model.ResetToken, model.NewPassword ); if (result.Succeeded) { await _signInManager.PasswordSignInAsync( adminUser.UserName, model.NewPassword, isPersistent : false, shouldLockout : false ); return(RedirectToLocal()); } } ModelState.AddModelError(string.Empty, GetLocalizedString <AreaResources>("SetNewPasswordGeneralError")); } return(View(model)); }
public ActionResult PasswordSetNew(string resetToken) { if (Request.IsAuthenticated) { return(RedirectToLocal()); } if (resetToken == null) { return(ErrorResult(HttpStatusCode.BadRequest)); } var model = new AccountPasswordRecoverResponseViewModel() { ResetToken = resetToken }; return(View(model)); }