示例#1
0
 public ActionResult Reset(PasswordReset model)
 {
     if (!ModelState.IsValid)
     {
         return View("Reset", model);
     }
     else
     {
         try
         {
             User user = _dynamicDb.RunProcedure<User>("SelectUserByName", new { UserName = model.UserName });
             string newKey = model.Key;//Security.GenerateResetKey(user.Password, 128);
             string encyrptedPwd = Security.Sha256Encrypt(model.Password);
             if (_dynamicDb.ExcuteQuery("ResetPassword", new { userId = user.UserId, key = newKey, newPassword = encyrptedPwd }))
             {
                 return RedirectToAction("Index", "Home");
             }
             return RedirectToAction("Contact", "Home");
         }
         catch (Exception ex)
         {
             _logger.Add(ex, "Emailer Failed", "User.ResetPassword", model.UserName);
             return RedirectToAction("Index", "Home");
         }
     }
 }
示例#2
0
 public ActionResult Reset(string user, string key)
 {
     PasswordReset model = new PasswordReset();
     model.UserName = user;
     model.Key = key;
     return View(model);
 }