Commit 2153500c authored by Elliot Pahl's avatar Elliot Pahl Committed by Elliot Pahl
Browse files

WR#59751, Provide meaningful error message to mnet users trying to log in to...

WR#59751, Provide meaningful error message to mnet users trying to log in to Mahara via Mahara's login form.
parent db974e21
......@@ -157,5 +157,32 @@ function execute_javascript_and_close($js='') {
exit;
}
$js = <<<EOF
function authloginmsgVisibility() {
// If Parent authority is 'None'
if ($('auth_config_parent').value != 0) {
addElementClass('auth_config_authloginmsg_container', 'hidden');
addElementClass(nextSiblingTR($('auth_config_authloginmsg_container')), 'hidden');
}
else {
removeElementClass('auth_config_authloginmsg_container', 'hidden');
removeElementClass(nextSiblingTR($('auth_config_authloginmsg_container')), 'hidden');
}
}
function nextSiblingTR(node) {
while (node.nextSibling.tagName != 'TR') {
node = node.nextSibling;
}
return node.nextSibling;
}
addLoadEvent(
function() {
connect('auth_config_parent', 'onchange', authloginmsgVisibility);
authloginmsgVisibility();
}
);
EOF;
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->display('admin/users/addauthority.tpl');
?>
......@@ -803,6 +803,13 @@ class LiveUser extends User {
return true;
}
// Display a message to users who are only allowed to login via their
// external application.
if ($auth->authloginmsg != '') {
global $SESSION;
$SESSION->add_error_msg($auth->authloginmsg);
}
return false;
}
......
<h3>Login Error Message</h3>
<p>When there is no parent authority, users are only able to log in via SSO and are unable to use Mahara's login form.</p>
<p>Enter a message here to show to users who try to log in using Mahara's login form. This message should contain instructions on how a user can gain access to Mahara through SSO.</p>
......@@ -62,6 +62,7 @@ class AuthXmlrpc extends Auth {
$this->config['theyssoin'] = 0;
$this->config['weimportcontent'] = 0;
$this->config['parent'] = null;
$this->config['authloginmsg'] = '';
if (!empty($id)) {
return $this->init($id);
}
......@@ -555,7 +556,8 @@ class PluginAuthXmlrpc extends PluginAuth {
'wessoout' => 0,
'theyssoin' => 0,
'weimportcontent' => 0,
'parent' => null
'parent' => null,
'authloginmsg' => ''
);
public static function has_config() {
......@@ -680,15 +682,6 @@ class PluginAuthXmlrpc extends PluginAuth {
'value' => 'xmlrpc'
);
$elements['parent'] = array(
'type' => 'select',
'title' => get_string('parent','auth'),
'collapseifoneoption' => false,
'options' => $options,
'defaultvalue' => self::$default_config['parent'],
'help' => true
);
$elements['wwwroot'] = array(
'type' => 'text',
'title' => get_string('wwwroot', 'auth'),
......@@ -769,6 +762,25 @@ class PluginAuthXmlrpc extends PluginAuth {
'help' => true
);
$elements['parent'] = array(
'type' => 'select',
'title' => get_string('parent','auth'),
'collapseifoneoption' => false,
'options' => $options,
'defaultvalue' => self::$default_config['parent'],
'help' => true
);
$elements['authloginmsg'] = array(
'type' => 'textarea',
'rows' => 3,
'cols' => 70,
'title' => '',
'description' => get_string('authloginmsg', 'auth'),
'defaultvalue' => self::$default_config['authloginmsg'],
'help' => true,
);
$elements['wessoout'] = array(
'type' => 'checkbox',
'title' => get_string('wessoout', 'auth'),
......@@ -920,6 +932,7 @@ class PluginAuthXmlrpc extends PluginAuth {
'weautocreateusers' => $values['weautocreateusers'],
'theyautocreateusers' => $values['theyautocreateusers'],
'parent' => $values['parent'],
'authloginmsg' => $values['authloginmsg'],
'wessoout' => $values['wessoout'],
'theyssoin' => $values['theyssoin'],
'weimportcontent' => $values['weimportcontent'],
......
......@@ -54,6 +54,7 @@ $string['parent'] = 'Parent authority';
$string['wessoout'] = 'We SSO out';
$string['weimportcontent'] = 'We import content (some applications only)';
$string['theyssoin'] = 'They SSO in';
$string['authloginmsg'] = "Enter a message to display when a user tries to log in via Mahara's login form";
$string['application'] = 'Application';
$string['cantretrievekey'] = 'An error occurred while retrieving the public key from the remote server.<br>Please ensure that the Application and WWW Root fields are correct, and that networking is enabled on the remote host.';
......
......@@ -2888,6 +2888,19 @@ table#initials .initial-letters {
padding: 5px;
}
/* MANAGE INSTITUTIONS > INSTITUTIONS > EDIT > Add Authority */
#auth_config_parent_container th {
padding-top: 15px;
}
#auth_config_parent_container td {
padding-top: 15px;
}
#auth_config_wessoout_container th {
padding-top: 15px;
}
#auth_config_wessoout_container td {
padding-top: 15px;
}
/* MANAGE INSTITUTIONS > INSTITUTION MEMBERS */
#usertypeselect {
......
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