Skip to content

Commit

Permalink
Added some errorcode param handling to login.php.
Browse files Browse the repository at this point in the history
  • Loading branch information
jounisuo committed Sep 16, 2016
1 parent f04888e commit 7c469c6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions login.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

include_once("../../config.php");


global $CFG, $PAGE, $OUTPUT;
include_once($CFG->libdir . "/authlib.php");

//HTTPS is required in this page when $CFG->loginhttps enabled
$PAGE->https_required();
Expand All @@ -21,6 +23,9 @@
exit;
}

$errorcode = optional_param('errorcode', 0, PARAM_INT);


$context = CONTEXT_SYSTEM::instance();
$PAGE->set_url("$CFG->httpswwwroot/auth/saml/login.php");
$PAGE->set_context($context);
Expand Down Expand Up @@ -72,6 +77,22 @@

$frm = data_submitted();

if ($errorcode == AUTH_LOGIN_UNAUTHORISED) {
$errormsg = get_string("unauthorisedlogin", "", $frm->username);
} else if($errorcode == AUTH_LOGIN_FAILED) {
$errormsg = get_string("invalidlogin");
} else if ($errorcode == AUTH_LOGIN_LOCKOUT) {
$errormsg = get_string('sessionerroruser', 'error');
} else if (!empty($SESSION->loginerrormsg)) {
// We had some errors before redirect, show them now.
$errormsg = $SESSION->loginerrormsg;
unset($SESSION->loginerrormsg);
}

if (!empty($errormsg) && method_exists($PAGE->requires, 'js_init_call')) {
$PAGE->requires->js_init_call('M.util.focus_login_error', null, true);
}

echo '<center>';

if (in_array('saml', $authsequence)){
Expand Down

0 comments on commit 7c469c6

Please sign in to comment.