diff --git a/configuration/portal_settings.ini b/configuration/portal_settings.ini index 9de705f2fc..7ddfc9a153 100644 --- a/configuration/portal_settings.ini +++ b/configuration/portal_settings.ini @@ -48,6 +48,10 @@ singlejobviewer = "off" ; set to 'off' in Open XDMoD until support has been added. multiple_service_providers = "off" +[sso] +; Set to "on" to enable the local user option in login modal. +show_local_login = "off" + [internal] dw_desc_cache = "off" diff --git a/html/gui/js/CCR.js b/html/gui/js/CCR.js index 5b6682333f..d1aee01e75 100644 --- a/html/gui/js/CCR.js +++ b/html/gui/js/CCR.js @@ -978,6 +978,9 @@ CCR.xdmod.ui.actionLogin = function (config, animateTarget) { if (success) { decodedResponse = CCR.checkDecodedJSONResponseSuccess(data); + if (Ext.isGecko) { + Ext.getCmp('local_login_submit').fireEvent('click'); + } } if (decodedResponse) { @@ -1004,42 +1007,63 @@ CCR.xdmod.ui.actionLogin = function (config, animateTarget) { }); }; - var localLoginItems = [txtLoginUsername, txtLoginPassword, { - xtype: 'tbtext', - id: 'login_response' - }, new Ext.Container({ - anchor: 'form', - autoWidth: true, - autoHeight: true, - layout: { - type: 'hbox' + var localLoginItems = [ + txtLoginUsername, + txtLoginPassword, + { + xtype: 'tbtext', + id: 'login_response' }, - items: [new Ext.Button({ - width: 75, - height: 22, - text: 'Sign in', - id: 'btn_sign_in', - handler: signInWithLocalAccount - }), new Ext.Container({ - autoEl: 'div', + { + xtype: 'field', + id: 'local_login_submit', + autoCreate: { + tag: 'input', + type: 'submit' + }, + hidden: true + }, + { + xtype: 'container', + anchor: 'form', autoWidth: true, - autoHeight: true, - id: 'assistancePrompt', + height: 38, + layout: { + type: 'hbox' + }, items: [{ - xtype: 'tbtext', - html: 'Forgot your password?', - id: 'forgot_password_link' - }, { - xtype: 'tbtext', - html: 'Don\'t have an account?', - id: 'sign_up_link' + xtype: 'button', + width: 75, + height: 22, + text: 'Sign in', + id: 'btn_sign_in', + handler: signInWithLocalAccount + }, + { + xtype: 'container', + autoEl: 'div', + autoWidth: true, + flex: 2, + height: 38, + id: 'assistancePrompt', + items: [{ + xtype: 'tbtext', + html: 'Forgot your password?', + id: 'forgot_password_link' + }, + { + xtype: 'tbtext', + html: 'Don\'t have an account?', + id: 'sign_up_link' + }] }] - })] - })]; + } + ]; var SSOLoginFrm = CCR.xdmod.isSSOConfigured ? new Ext.form.FormPanel({ id: 'sso_login_form', title: 'Sign in with ' + accountName + ':', + width: 321, items: [{ xtype: 'button', text: 'Login here.', @@ -1090,6 +1114,15 @@ CCR.xdmod.ui.actionLogin = function (config, animateTarget) { if (CCR.xdmod.isSSOConfigured) { loginItems.push(SSOLoginFrm); + if (!CCR.xdmod.SSOShowLocalLogin) { + localLoginFrm.collapsible = true; + localLoginFrm.collapsed = true; + localLoginFrm.titleCollapse = true; + /** + * the span is added to the title because without it the cursor does not show as clickable. + */ + localLoginFrm.title = '' + localLoginFrm.title + ''; + } loginItems.push(localLoginFrm); } else { loginItems.push(localLoginFrm); diff --git a/html/index.php b/html/index.php index 5e5775c8dd..a6b665fa1e 100644 --- a/html/index.php +++ b/html/index.php @@ -308,7 +308,7 @@ function isReferrer($referrer) } } catch (exception $ex) { } - print "CCR.xdmod.captcha_sitekey = '" . $captchaSiteKey . "';"; + print "CCR.xdmod.captcha_sitekey = '" . $captchaSiteKey . "';\n"; if (!$userLoggedIn) { $auth = null; try { @@ -317,10 +317,20 @@ function isReferrer($referrer) // This will catch when a configuration directory does not exist if it is set in the environment level } if ($auth && $auth->isSamlConfigured()) { + $ssoShowLocalLogin = false; + try { + $ssoShowLocalLogin = filter_var( + xd_utilities\getConfiguration('sso', 'show_local_login'), + FILTER_VALIDATE_BOOLEAN + ); + } catch (exception $ex) { + } + print "CCR.xdmod.isSSOConfigured = true;\n"; print "CCR.xdmod.SSOLoginLink = " . json_encode($auth->getLoginLink()) . ";\n"; + print "CCR.xdmod.SSOShowLocalLogin = " . json_encode($ssoShowLocalLogin) . "\n"; } else { - print "CCR.xdmod.isSSOConfigured = false;"; + print "CCR.xdmod.isSSOConfigured = false;\n"; } } if ($userLoggedIn) { diff --git a/templates/portal_settings.template b/templates/portal_settings.template index 8b6c38f90b..db22224007 100644 --- a/templates/portal_settings.template +++ b/templates/portal_settings.template @@ -48,6 +48,10 @@ singlejobviewer = "off" ; set to 'off' in Open XDMoD until support has been added. multiple_service_providers = "off" +[sso] +; Set to "on" to enable the local user option in login modal. +show_local_login = "off" + [internal] dw_desc_cache = "off"