I have updated the login view to no longer show the user name and password fields and force them to click a button to login via SSO. Is it possible to persist this change between updates, even if it has to be some custom JS to do it on page load is fine. Ideally there would be a setting that I can “Enable SSO Login” and provide a URL and the view would render a button for me, but any workaround would be appreciated.
We’ve had this exact issue in the past, and our solution was to do all of the modifications via the core_boot hook by injecting custom JS. This should get you started:
// inject JS on the login page to add SSO button and tabs
// doing it here avoids core template changes to View/account/login.php
public function core_boot()
{
if (REQ === 'CP' && $_SERVER['QUERY_STRING'] === '/cp/login') {
require_once SYSPATH . 'ee/legacy/libraries/View.php';
$view = new View();
echo $view->script_tag('jquery/jquery.js');
echo $view->script_tag('common.js');
echo '[removed]' . file_get_contents(FCPATH .'js/admin/login-page-sso.js') . '[removed]';
}
}And the JS:
$(function () {
var $form = $('form');
var $fields = $form.find('fieldset');
$form.prepend('\
<div class="tab-wrap">\
<div class="tab-bar">\
<div class="tab-bar__tabs">\
<button type="button" class="tab-bar__tab js-tab-button active" rel="t-0">With SSO</button>\
<button type="button" class="tab-bar__tab js-tab-button" rel="t-1">With Password</button>\
</div>\
</div>\
<div class="tab t-0 tab-open">\
<a href="/?ACT=whatever" class="button button--primary button--large button--wide">Sign in with SSO</a>\
</div>\
<div class="tab t-1">\
</div>\
</div>\
');
// move form elements to second tab
$form.find('.tab.t-1').append($fields);
});All of you, I appreciate your thoughts on this. I will play around with your comprehensive example today; thank you. car games
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.