Esempio n. 1
0
        public async Task <ActionResult> ResetPassword(ResetPasswordViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var user = await UserManager.FindByNameAsync(model.Email);

            if (user == null)
            {
                // Don't reveal that the user does not exist
                return(RedirectToAction("ResetPasswordConfirmation", "Account"));
            }
            var result = await UserManager.ResetPasswordAsync(user.UserName, model.Code, model.Password);

            if (result)
            {
                return(RedirectToAction("ResetPasswordConfirmation", "Account"));
            }
            AddError("Failed.");
            return(View());
        }