Skip to content

Commit

Permalink
Update Sign On Panel
Browse files Browse the repository at this point in the history
  • Loading branch information
plessbd committed Oct 12, 2018
1 parent 7f426ef commit 1cf90b6
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 32 deletions.
1 change: 1 addition & 0 deletions configuration/portal_settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ multiple_service_providers = "off"

[sso]
force_default_organization = "on"
colapse_local_login = "true"

[internal]
dw_desc_cache = "off"
Expand Down
92 changes: 62 additions & 30 deletions html/gui/js/CCR.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -1004,42 +1007,62 @@ 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
},
new Ext.Container({
anchor: 'form',
autoWidth: true,
autoHeight: true,
id: 'assistancePrompt',
items: [{
xtype: 'tbtext',
html: '<a href="javascript:CCR.xdmod.ui.forgot_password()">Forgot your password?</a>',
id: 'forgot_password_link'
}, {
xtype: 'tbtext',
html: '<a href="javascript:presentSignUpViaLoginPrompt()">Don\'t have an account?</a>',
id: 'sign_up_link'
}]
})]
})];
height: 38,
layout: {
type: 'hbox'
},
items: [
new Ext.Button({
width: 75,
height: 22,
text: 'Sign in',
id: 'btn_sign_in',
handler: signInWithLocalAccount
}),
new Ext.Container({
autoEl: 'div',
autoWidth: true,
flex: 2,
height: 38,
id: 'assistancePrompt',
items: [{
xtype: 'tbtext',
html: '<a href="javascript:CCR.xdmod.ui.forgot_password()">Forgot your password?</a>',
id: 'forgot_password_link'
},
{
xtype: 'tbtext',
html: '<a href="javascript:presentSignUpViaLoginPrompt()">Don\'t have an account?</a>',
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: '<img src="' + CCR.xdmod.SSOLoginLink.icon + '" alt="Login here."></img>',
Expand Down Expand Up @@ -1090,6 +1113,15 @@ CCR.xdmod.ui.actionLogin = function (config, animateTarget) {

if (CCR.xdmod.isSSOConfigured) {
loginItems.push(SSOLoginFrm);
if (CCR.xdmod.SSOcolapseLocalLogin) {
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 = '<span style="cursor:pointer;">Sign in with a local XDMoD account:</span>';
}
loginItems.push(localLoginFrm);
} else {
loginItems.push(localLoginFrm);
Expand Down
14 changes: 12 additions & 2 deletions html/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,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 {
Expand All @@ -312,10 +312,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()) {
$ssoColapse = 'true';
try {
$ssoColapseSetting = filter_var(xd_utilities\getConfiguration('sso', 'colapse_local_login'), FILTER_VALIDATE_BOOLEAN, array('flags' => FILTER_NULL_ON_FAILURE));
if($ssoColapseSetting === false){
$ssoColapse = 'false';
}
} catch (exception $ex) {
}

print "CCR.xdmod.isSSOConfigured = true;\n";
print "CCR.xdmod.SSOLoginLink = " . json_encode($auth->getLoginLink()) . ";\n";
print "CCR.xdmod.SSOcolapseLocalLogin = " . $ssoColapse . "\n";
} else {
print "CCR.xdmod.isSSOConfigured = false;";
print "CCR.xdmod.isSSOConfigured = false;\n";
}
}
if ($userLoggedIn) {
Expand Down
1 change: 1 addition & 0 deletions templates/portal_settings.template
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ multiple_service_providers = "off"

[sso]
force_default_organization = "on"
colapse_local_login = "true"

[internal]
dw_desc_cache = "off"
Expand Down

0 comments on commit 1cf90b6

Please sign in to comment.