Exemple #1
0
        public ActionResult ResetContra(ResetContraModel model)
        {
            var message = "";

            if (ModelState.IsValid)
            {
                using (SAVEntities db = new SAVEntities())
                {
                    var user = db.USUARIO.Where(a => a.ReseteoContraCode == model.ResetCode).FirstOrDefault();
                    if (user != null)
                    {
                        user.CONTASENA         = Crypto.Hash(model.NuevaContra);
                        user.ReseteoContraCode = "";
                        db.Configuration.ValidateOnSaveEnabled = false;
                        db.SaveChanges();
                        message = "Nueva contraseña actulizada con exito";
                    }
                }
            }
            else
            {
                message = "algo invalido";
            }
            ViewBag.Message = message;
            return(View(model));
        }
Exemple #2
0
 public ActionResult ResetContra(string id)
 {
     using (SAVEntities db = new SAVEntities())
     {
         var user = db.USUARIO.Where(a => a.ReseteoContraCode == id).FirstOrDefault();
         if (user != null)
         {
             ResetContraModel model = new ResetContraModel();
             model.ResetCode = id;
             return(View(model));
         }
         else
         {
             return(HttpNotFound());
         }
     }
 }