Commit c642e6aa authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1734557: Allow SAML to show custom login error msg



Similar to what xml-rpc does, so allowing admin to set a message about
how to properly login

behatnotneeded

Change-Id: Ib4a85571dccf0fcf719785481645777c506687da
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
parent 111fba57
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
<!-- @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later -->
<!-- @copyright For copyright information on Mahara, please see the README file distributed with this software. -->
<h3>Login error message</h3>
<p>When 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>
+35 −1
Original line number Diff line number Diff line
@@ -90,6 +90,8 @@ class AuthSaml extends Auth {
        $this->config['loginlink'] = false;
        $this->config['institutionidp'] = '';
        $this->config['institutionidpentityid'] = '';
        $this->config['parent'] = null;
        $this->config['authloginmsg'] = '';
        $this->instanceid = $id;

        if (!empty($id)) {
@@ -346,7 +348,9 @@ class PluginAuthSaml extends PluginAuth {
        'remoteuser'             => 1,
        'loginlink'              => 0,
        'institutionidpentityid' => '',
        'active'                 => 1
        'active'                 => 1,
        'parent'                 => null,
        'authloginmsg'           => ''
    );

    public static function can_be_disabled() {
@@ -852,6 +856,17 @@ jQuery('document').ready(function($) {
</script>
EOF;

        $instances = auth_get_auth_instances_for_institution($institution);
        $options = array('None');
        if (is_array($instances)) {
            foreach($instances as $someinstance) {
                if ($someinstance->requires_parent == 1 || $someinstance->authname == 'none' || $someinstance->authname == 'saml') {
                    continue;
                }
                $options[$someinstance->id] = $someinstance->instancename;
            }
        }

        $elements = array(
            'instance' => array(
                'type'  => 'hidden',
@@ -976,6 +991,23 @@ EOF;
                'defaultvalue' => self::$default_config['studentidfield'],
                'help' => true,
            ),
            'parent' => array(
                'type'                => 'select',
                'title'               => get_string('parent','auth'),
                'collapseifoneoption' => false,
                'options'             => $options,
                'defaultvalue'        => self::$default_config['parent'],
                'help'   => true
            ),
            'authloginmsg' => array(
                'type'         => 'wysiwyg',
                'rows'         => 10,
                'cols'         => 70,
                'title'        => '',
                'description'  => get_string('authloginmsgnoparent', 'auth'),
                'defaultvalue' => self::$default_config['authloginmsg'],
                'help'         => true,
            ),
        );

        return array(
@@ -1138,6 +1170,8 @@ EOF;
            'institutionvalue' => $values['institutionvalue'],
            'institutionregex' => $values['institutionregex'],
            'institutionidpentityid' => $entityid,
            'parent' => $values['parent'],
            'authloginmsg' => $values['authloginmsg'],
        );

        foreach(self::$default_config as $field => $value) {
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ $string['weimportcontent'] = 'We import content';
$string['weimportcontentdescription'] = '(some applications only)';
$string['theyssoin'] = 'They SSO in';
$string['authloginmsg2'] = "When you have not chosen a parent authority, enter a message to display when a user tries to log in via the login form";
$string['authloginmsgnoparent'] = "Enter a message to display when a user tries to log in via the 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.';
$string['ssodirection'] = 'SSO direction';