/// <summary> /// Fixed: /// </summary> public (string redirectUrl, string redirectResultUrl, string html) Login( Context context, string returnUrl, bool isLocalUrl, string ssocode = "") { var log = new SysLogModel(context: context); if (context.Authenticated) { if (context.QueryStrings.Bool("new")) { Authentications.SignOut(context: context); } log.Finish(context: context); return(isLocalUrl ? returnUrl : Locations.Top(context: context), null, null); } if ((Parameters.Authentication.Provider == "SAML-MultiTenant") && (ssocode != string.Empty)) { var tenant = new TenantModel().Get( context: context, ss: SiteSettingsUtilities.TenantsSiteSettings(context), where : Rds.TenantsWhere().Comments(ssocode)); if (tenant.AccessStatus == Databases.AccessStatuses.Selected) { var redirectUrl = Saml.SetIdpConfiguration(context, tenant.TenantId); if (redirectUrl != null) { return(null, redirectUrl, null); } } return(null, Locations.InvalidSsoCode(context), null); } var html = UserUtilities.HtmlLogin( context: context, returnUrl: isLocalUrl ? returnUrl : string.Empty, message: context.QueryStrings.ContainsKey("expired") && context.QueryStrings["expired"] == "1" && !context.Ajax ? Messages.Expired(context: context).Text : string.Empty); log.Finish(context: context, responseSize: html.Length); return(null, null, html); }
public ActionResult Login(string returnUrl, string ssocode = "") { var context = new Context(); var log = new SysLogModel(context: context); if ((Parameters.Authentication.Provider == "SAML-MultiTenant") && (ssocode != string.Empty)) { var tenant = new TenantModel().Get( context: context, ss: SiteSettingsUtilities.TenantsSiteSettings(context), where : Rds.TenantsWhere().Comments(ssocode)); if (tenant.AccessStatus == Databases.AccessStatuses.Selected) { Authentications.SignOut(context: context); var redirectUrl = Saml.SetIdpConfiguration(context, tenant.TenantId); if (redirectUrl != null) { return(new RedirectResult(redirectUrl)); } } return(new RedirectResult(Locations.InvalidSsoCode(context))); } if (context.Authenticated) { if (context.QueryStrings.Bool("new")) { Authentications.SignOut(context: context); } log.Finish(context: context); return(base.Redirect(Url.IsLocalUrl(returnUrl) ? returnUrl : Locations.Top(context: context))); } var html = UserUtilities.HtmlLogin( context: context, returnUrl: Url.IsLocalUrl(returnUrl) ? returnUrl : "", message: Request.QueryString["expired"] == "1" && !Request.IsAjaxRequest() ? Messages.Expired(context: context).Text : string.Empty); ViewBag.HtmlBody = html; log.Finish(context: context, responseSize: html.Length); return(View()); }