public ActionResult Login(LoginModel model) { var repository = new UsersRepository(); var verify = repository.Login(model.Password, model.Username); try { if (verify) { var ticket = new FormsAuthenticationTicket(1, model.Username, DateTime.Now, DateTime.Now.AddSeconds(30), model.Persistent, ""); var strEncryptedTicket = FormsAuthentication.Encrypt(ticket); var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, strEncryptedTicket); Response.Cookies.Add(cookie); return RedirectToAction(Actions.Index, HomeController.Name); } } catch (Exception) { } return View(Views.Login); }
public ActionResult LogOut(LoginModel model) { Response.Cookies.Remove(".ASPXAUTH"); return View(Views.Login); }
public ActionResult Index(LoginModel model) { return View(Views.Login); }