Commit 37a126cc authored by Elliot Pahl's avatar Elliot Pahl Committed by Elliot Pahl
Browse files

Provide meaningful error message to mnet users trying to log in to Mahara via Mahara's login form.

parent ac932c92
......@@ -154,5 +154,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');
?>
......@@ -634,6 +634,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>
......@@ -63,6 +63,7 @@ class AuthXmlrpc extends Auth {
$this->config['wessoout'] = 0;
$this->config['theyssoin'] = 0;
$this->config['parent'] = null;
$this->config['authloginmsg'] = '';
$this->file = fopen('/tmp/out.txt', 'w');
if (!empty($id)) {
return $this->init($id);
......@@ -565,7 +566,8 @@ class PluginAuthXmlrpc extends PluginAuth {
'theyautocreateusers' => 0,
'wessoout' => 0,
'theyssoin' => 0,
'parent' => null
'parent' => null,
'authloginmsg' => ''
);
public static function has_config() {
......@@ -690,15 +692,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'),
......@@ -779,6 +772,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'),
......@@ -923,8 +935,9 @@ class PluginAuthXmlrpc extends PluginAuth {
'weautocreateusers' => $values['weautocreateusers'],
'theyautocreateusers' => $values['theyautocreateusers'],
'parent' => $values['parent'],
'authloginmsg' => $values['authloginmsg'],
'wessoout' => $values['wessoout'],
'theyssoin' => $values['theyssoin']
'theyssoin' => $values['theyssoin'],
);
foreach(self::$default_config as $field => $value) {
......
......@@ -53,6 +53,7 @@ $string['theyautocreateusers'] = 'They auto-create users';
$string['parent'] = 'Parent authority';
$string['wessoout'] = 'We SSO out';
$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.';
......
......@@ -2544,6 +2544,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 {
......
Supports Markdown
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