public ActionResult Login(LoginModel userlogin) { if (ModelState.IsValid) { pilogicEntities dbcontext = new pilogicEntities(); User userget = dbcontext.User.Where(x => x.username.Equals(userlogin.UserName, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); userget.tokenid = userget.username + DateTime.Now.TimeOfDay.ToString(); if (sha256(userlogin.PassWord) == userget.password) { FormsAuthentication.SetAuthCookie(userget.username, true); if (Session["UserLoged"] == null && userget != null) { Session["UserLoged"] = userget; } return(Redirect("/Home/ClientPanel")); } else { ViewBag.errokey = "Contraseña Invalida"; return(View("Login")); } dbcontext.Dispose(); } else { return(View("Login")); } }
public JsonResult ValidateEmail(string email) { pilogicEntities dbcontext = new pilogicEntities(); User userget = dbcontext.User.Where(x => x.email.Equals(email, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); if (userget != null) { return(Json("El email ya se encuentra Registrado", JsonRequestBehavior.AllowGet)); } else { return(Json(true, JsonRequestBehavior.AllowGet)); } dbcontext.Dispose(); }
public JsonResult Validate(string LoginName) { pilogicEntities dbcontext = new pilogicEntities(); User userget = dbcontext.User.Where(x => x.username.Equals(LoginName, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); if (userget != null) { return(Json("El Usuario Ya Existe", JsonRequestBehavior.AllowGet)); } else { return(Json(true, JsonRequestBehavior.AllowGet)); } dbcontext.Dispose(); }