public ActionResult Index(SignInRequest model, string returnUrl) { string redirectUrl = string.Empty; if (ModelState.IsValid) { try { var ip = Request.UserHostAddress; using (var authService = new AuthenticationSrv()) { var user = authService.AuthenticateUser(model); authService.SetAuthCookie(); var browser = Request.Browser.Browser + Request.Browser.Version; var sessionId = HttpContext.Session.SessionID; LogSessionAsync(browser, ip, user, sessionId); } return(SafeRedirect(returnUrl, true)); } catch (SimpleException ex) { ModelState.AddModelError("", ex.Message); } } return(View(model)); }
public ActionResult Logout() { using (var authService = new AuthenticationSrv()) { var sessionId = HttpContext.Session.SessionID; LogOutSessionAsync(sessionId); authService.SignOut(); } return(RedirectToAction("Index")); }
public JsonResult Password(PasswordVm model) { if (ModelState.IsValid) { try { using (var srv = new AuthenticationSrv()) { srv.UpdatePassowrd(model.NewPassword, model.CurrentPassword); } } catch (SimpleException ex) { AddModelError(ex); } } return(GetErrorMsgJSON()); }