public ActionResult Index(DirectLinkOptions directLinkOptions, LogOnCredentials data) { try { data.Validate(); } catch (RulesException ex) { ex.Extend(ModelState); } if (ModelState.IsValid && data.User != null) { AuthenticationHelper.CompleteAuthentication(data.User); if (Request.IsAjaxRequest()) { return(Json(new { success = true, isAuthenticated = true, userName = data.User.Name })); } if (directLinkOptions != null && directLinkOptions.IsDefined()) { return(RedirectToAction("Index", "Home", directLinkOptions)); } return(RedirectToAction("Index", "Home")); } FillViewBagData(); return(LogOnView()); }
public ActionResult Index(bool?useAutoLogin, DirectLinkOptions directLinkOptions) { var data = new LogOnCredentials { UseAutoLogin = useAutoLogin ?? true, NtUserName = GetCurrentUser() }; InitViewBag(directLinkOptions); return(LogOnView(data)); }
public async Task <ActionResult> Index(bool?useAutoLogin, DirectLinkOptions directLinkOptions) { var data = new LogOnCredentials { UseAutoLogin = useAutoLogin ?? IsWindowsAuthentication(), NtUserName = GetCurrentUser() }; FillViewBagData(directLinkOptions); return(await LogOnView(data)); }
private async Task <ActionResult> PostIndex(bool?useAutoLogin, LogOnCredentials data, string returnUrl) { data.UseAutoLogin = useAutoLogin ?? IsWindowsAuthentication(); data.NtUserName = GetCurrentUser(); try { data.Validate(); } catch (RulesException ex) { ex.Extend(ModelState, _provider); } if (ModelState.IsValid && data.User != null) { _helper.SignIn(data.User); if (Request.IsAjaxRequest()) { return(Json(new { success = true, isAuthenticated = true, userName = data.User.Name })); } if (!string.IsNullOrEmpty(returnUrl)) { return(LocalRedirect(returnUrl)); } return(RedirectToAction("Index", "Home")); } FillViewBagData(); return(await LogOnView(data)); }
private ActionResult LogOnView(LogOnCredentials model) => Request.IsAjaxRequest() ? JsonHtml("Popup", model) : View(model);
public ActionResult Index(bool?useAutoLogin, DirectLinkOptions directLinkOptions, LogOnCredentials data) { data.UseAutoLogin = useAutoLogin ?? true; data.NtUserName = GetCurrentUser(); try { data.Validate(); } catch (RulesException ex) { ex.Extend(ModelState); } if (ModelState.IsValid && data.User != null) { AuthenticationHelper.CompleteAuthentication(data.User); if (Request.IsAjaxRequest()) { return(Json(new { success = true, isAuthenticated = true, userName = data.User.Name })); } var redirectUrl = QPConfiguration.WebConfigSection.BackendUrl; if (directLinkOptions != null) { redirectUrl = directLinkOptions.AddToUrl(redirectUrl); } return(Redirect(redirectUrl)); } InitViewBag(directLinkOptions); return(LogOnView(data)); }
public async Task <ActionResult> JsonIndex(bool?useAutoLogin, [FromBody] LogOnCredentials data, string returnUrl) { return(await PostIndex(useAutoLogin, data, returnUrl)); }