public LoginModel Login(LoginModel model) { this.mSessionRepository.Logout(); model.LoginStatus = LoginStatus.InvalidUser; if (this.mSessionRepository.Validate(model)) { if (!this.mSessionRepository.IsAuthenticated()) { var userModel = this.GetUser(model.Username); this.mSessionRepository.CreateAuthCookie(userModel); this.mUserService.SetAccessLevel(userModel); Mapper.Map(userModel, model); model.LoginStatus = LoginStatus.LoggedIn; } } else { HttpContext.Current.Response.StatusCode = 403; if (model.Username != null && this.mSessionRepository.IsUserLockedOut(model.Username)) { model.LoginStatus = LoginStatus.LockedOut; HttpContext.Current.Response.StatusCode = 423; } } return model; }
public LoginModel GetSession() { LoginModel model = new LoginModel(); model.LoginStatus = LoginStatus.InvalidUser; if (this.mSessionRepository.IsAuthenticated()) { UserModel userModel = this.GetUser(this.mSessionRepository.GetCurrentUsername()); this.mUserService.SetAccessLevel(userModel); Mapper.Map(userModel, model); model.LoginStatus = LoginStatus.LoggedIn; } return model; }
public ActionResult Login(LoginModel model, string ReturnUrl) { var response = this.mSessionService.Login(model); if (response.LoginStatus != LoginStatus.LoggedIn) { return View("Login", model); } else { ReturnUrl = string.IsNullOrWhiteSpace(ReturnUrl) ? "/" : ReturnUrl; return Redirect(ReturnUrl); } }
public ActionResult Login(LoginModel model) { var entity = this.mSessionService.Login(model); return Json(entity); }
public bool Validate(LoginModel user) { return Membership.ValidateUser(user.Username, user.Password); }