public ActionResult Login(string returnUrl, LoginViewModel command) { var result = _authenticationHelper.LogUserIn(this, command, new CofoundryAdminUserArea()); if (result.IsAuthenticated && result.RequiresPasswordChange) { return(Redirect(AuthRouteLibrary.Urls.ChangePassword(returnUrl))); } else if (result.IsAuthenticated && !string.IsNullOrEmpty(result.ReturnUrl)) { return(Redirect(result.ReturnUrl)); } else if (result.IsAuthenticated) { _userContextService.ClearCache(); return(GetLoggedInDefaultRedirectAction()); } return(View(command)); }
public async Task <ActionResult> Login(string returnUrl, LoginViewModel command) { var result = await _authenticationHelper.LogUserInAsync(this, command, _adminUserArea); if (result.RequiresPasswordChange) { return(Redirect(_adminRouteLibrary.Auth.ChangePassword(returnUrl))); } else if (result.IsAuthenticated && !string.IsNullOrEmpty(returnUrl) && Url.IsLocalUrl(returnUrl)) { return(Redirect(returnUrl)); } else if (result.IsAuthenticated) { _userContextService.ClearCache(); return(await GetLoggedInDefaultRedirectActionAsync()); } var viewPath = ViewPathFormatter.View(CONTROLLER_NAME, nameof(Login)); return(View(viewPath, command)); }
/// <summary> /// Signs the user out of the application and ends the session. /// </summary> /// <param name="userAreaCode">The code of the user area to log out of.</param> public virtual async Task SignOutAsync(string userAreaCode) { await _userSessionService.LogUserOutAsync(userAreaCode); _userContextService.ClearCache(); }
/// <summary> /// Signs the user out of the application and ends the session. /// </summary> public void SignOut() { _userSessionService.Abandon(); _userContextService.ClearCache(); }