Beispiel #1
0
 internal static bool RestorePassword(RestorePasswordModel model)
 {
     var newpass = "";
     if (!String.IsNullOrEmpty( newpass = dataAccess.RestorePassword(model)))
     {
         EmailSender.SendResetEmail(model.Email, model.UserName, newpass);
         return true;
     }
     return false;
 }
 public string RestorePassword(RestorePasswordModel model)
 {
     var result = "";
     var etalon = _dataBase.Users.FirstOrDefault(u => u.Username == model.UserName);
     if (etalon != null && etalon.Email == model.Email)
     {
         result = GenerateRandomPass();
         etalon.Password = result;
         _dataBase.SaveChanges();
     }
     return result;
 }
 public ActionResult RestorePassword(RestorePasswordModel model)
 {
     if (ModelState.IsValid)
     {
         if (Auction.RestorePassword(model))
         {
             return RedirectToAction("EmailIsSent");
         }
     }
     ModelState.AddModelError("", "The username or email is incorrect.");
     return View(model);
 }