Commit b75248fb authored by Kevin Paxman's avatar Kevin Paxman
Browse files

Merge branch 'feature/ISTWCMS-3682-tstruyk-adfs-user-form' into '1.0.x'

ISTWCMS-3682: ADFS Addition, Modify User Login Form

See merge request !43
parents f4bcf6ed 12c6b8e4
# Ignore compiled files.
source
js
# Ignore directories
images/images
......
!function(l,i){i.behaviors.uwFdsuThemeRespUserLogin={attach:function(i,n){l("#edit-simplesamlphp-auth-login-link").length&&(l("#user-login-form").css("display","none"),l("#user-login-form").after('<button id="adfs-login-link" class="button--primary">Log in via ADFS</button> &nbsp; <button id="local-login-link" class="button--medium">Log in locally</button>'),l("#edit-submit").val("Log in locally"),l("#local-login-link").click(function(){l("#user-login-form").css("display","block"),l("#local-login-link").css("display","none"),l("#adfs-login-link").css("display","none"),l("#edit-name").focus()}),l("#adfs-login-link").click(function(){l("#edit-simplesamlphp-auth-login-link")[0].click()}))}}}(jQuery,Drupal);
(function ($, Drupal) {
Drupal.behaviors.uwFdsuThemeRespUserLogin = {
attach: function (context, settings) {
// Don't do anything if SimpleSAML isn't enabled.
if ($('#edit-simplesamlphp-auth-login-link').length)
{
// Hide the normal login form.
$('#user-login-form').css('display', 'none');
// Add buttons (using JS because they don't work without JS)
$('#user-login-form').after('<button id="adfs-login-link" class="button--primary">Log in via ADFS</button> &nbsp; <button id="local-login-link" class="button--medium">Log in locally</button>');
// Update the existing login form's link text.
$('#edit-submit').val('Log in locally');
// If the local login link is clicked, show the normal login form and hide the buttons.
// Be nice to the user, and put focus on the name field so they can just start typing.
$('#local-login-link').click(function () {
$('#user-login-form').css('display', 'block');
$('#local-login-link').css('display', 'none');
$('#adfs-login-link').css('display', 'none');
$('#edit-name').focus();
});
// If the ADFS login link is clicked, click on the original log in with ADFS link.
$('#adfs-login-link').click(function () {
$('#edit-simplesamlphp-auth-login-link')[0].click();
});
}
}
};
})(jQuery, Drupal);
......@@ -21,3 +21,6 @@ uw_dashboards:
css:
theme:
../../modules/custom/uw_wcms_gesso/css/uw-dashboards.min.css: {}
user.login:
js:
js/user-login-min.js: {}
......@@ -36,6 +36,12 @@ function uw_fdsu_theme_resp_preprocess_html(&$variables) {
$variables['uw_admin_page'] = \Drupal::service('uw_cfg_common.uw_analytics')->administrationPage();
_uw_fdsu_theme_resp_add_favicons($variables);
// Add Javascript only on the user login page.
$route_name = \Drupal::routeMatch()->getRouteName();
if ($route_name == 'user.login') {
$variables['#attached']['library'][] = 'uw_fdsu_theme_resp/user.login';
}
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment