public ActionResult SignIn(string email, string password) { if (user != null) return RedirectToAction("Index", "Home"); var context = new SpectroContext(); ViewBag.email = email; ViewBag.password = password; password = Crypto.SHA256(password).ToLower(); Account account = context.Accounts.First(a => a.Email == email); if (account.Password == password) { FormsAuthentication.SetAuthCookie(account.Email, createPersistentCookie: true); Session["Account"] = account; return RedirectToAction("Index", "Home"); } else { ViewBag.error = "Invalid email / password combination"; } return View(); }
public _BaseController() { this.context = new SpectroContext(); }