Exemplo n.º 1
0
 public async Task<ActionResult> RestablecerPasswordAdmin(ResetPasswordViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return View(model);
     }
     var user = await UserManager.FindByNameAsync(model.UserName);
     if (user == null)
     {
         // Don't reveal that the user does not exist
         return RedirectToAction("index", "usuarios");
     }
     user.AccessCount = 0;
     user.AccessFailedCount = 0;
     user.LockoutEndDateUtc = null;
     var res = await UserManager.UpdateAsync(user);
     var result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);
     if (result.Succeeded)
     {
         return RedirectToAction("index", "usuarios");
     }
     AddErrors(result);
     return View();
 }
Exemplo n.º 2
0
        public ActionResult RestablecerPasswordAdmin(string code, string userName, string nombre)
        {
            ResetPasswordViewModel model = new ResetPasswordViewModel();

            model.UserName = userName;
            model.Code = code;
            ViewBag.Nombre = nombre;
            return code == null ? View("Error") : View(model);
        }