public ActionResult Login(string returnUrl) { var model = new LoginModel { ReturnUrl = returnUrl }; return View(model); }
public ActionResult Login(LoginModel model) { if (!ModelState.IsValid) { return View(model); } var user = _applicationService.GetTeacherByLogin(model.Login); if (user == null) { AddWrongEmailPasswordError(); return View(model); } if (model.Password == user.Password) { var identity = _authenticationService.CreateTeacherIdentity(user); _authenticationService.SignIn(identity, Request); return RedirectToAction("Index", "Home"); } AddWrongEmailPasswordError(); return View(model); }