Example #1
0
        public async Task <IActionResult> ResetUserPassword(string Id)
        {
            AppUser user = await userManager.FindByIdAsync(Id);

            PasswordResetAdminByUserViewModel passadmin = new PasswordResetAdminByUserViewModel();

            passadmin.UserId = user.Id;
            return(View(passadmin));
        }
Example #2
0
        public async Task <IActionResult> ResetUserPassword(PasswordResetAdminByUserViewModel model)
        {
            AppUser user = await userManager.FindByIdAsync(model.UserId);

            string token = await userManager.GeneratePasswordResetTokenAsync(user);

            await userManager.ResetPasswordAsync(user, token, model.NewPassword);

            await userManager.UpdateSecurityStampAsync(user);

            await userManager.GetLockoutEnabledAsync(user);

            return(RedirectToAction("Users"));
        }