Ejemplo n.º 1
0
 public ActionResult ResetPassword(ResetForm form)
 {
     if (!ModelState.IsValid)
     {
         return View(form);
     }
     MemoryCache cache = MemoryCache.Default;
     if (cache.Contains(form.Token))
     {
         var email = cache.Get(form.Token).ToString();
         User u = GlobalData.dbContext.Users.SingleOrDefault(m => m.Email == email);
         if (u != null)
         {
             u.Password = StringHelper.CalcPassword(form.NewPassword, u.Salt);
             cache.Remove(form.Token);
             GlobalData.dbContext.SaveChanges();
             return CountDown("Your password has already been updated, please <a href=\"/Account/Login\">Login</a>!");
         }
     }
     ModelState.AddModelError("", "Your token is invalid.");
     return View();
 }
Ejemplo n.º 2
0
 public ActionResult ResetPassword(string token)
 {
     var model = new ResetForm { Token = token };
     return View(model);
 }