public ActionResult Registration(log_in user) { if (ModelState.IsValid) { using (var db = new login_simpleEntities()) { var crypt = new SimpleCrypto.PBKDF2(); int size = crypt.SaltSize; var cryptPass = crypt.Compute(user.pass); log_in newUser = new log_in() { email = user.email, pass = cryptPass, passsalt = crypt.Salt }; db.log_in.Add(newUser); try { db.SaveChanges(); } catch(Exception e) { Debug.Print("Here is the error! " + e.Message); } } } return View(); }
public ActionResult Login(log_in user) { if (ValidPass(user.email, user.pass)) { FormsAuthentication.SetAuthCookie(user.email, false); return RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("","login failure"); } return View(); }