Commit 8324204f authored by David Mudrák's avatar David Mudrák

MDL-63994 login: Clarify inline comments on loginpage_hook() usage

While working on the issue, I found these inline comments outdated and
confusing. The auth plugin types can implement a loginpage_hook()
method, the purpose of which is to inject the $user and/or $frm into
this login/index.php script. The new comments should make it more clear.

Note the second comment mentioned a prelogin_hook() which was an old
name of what is now called loginpage_hook(). It had nothing to do with
the existing pre_loginpage_hook() and was only confusing.
parent 5c5ee48b
...@@ -81,13 +81,13 @@ if (!empty($SESSION->has_timed_out)) { ...@@ -81,13 +81,13 @@ if (!empty($SESSION->has_timed_out)) {
$session_has_timed_out = false; $session_has_timed_out = false;
} }
/// auth plugins may override these - SSO anyone?
$frm = false; $frm = false;
$user = false; $user = false;
$authsequence = get_enabled_auth_plugins(true); // auths, in sequence $authsequence = get_enabled_auth_plugins(true); // auths, in sequence
foreach($authsequence as $authname) { foreach($authsequence as $authname) {
$authplugin = get_auth_plugin($authname); $authplugin = get_auth_plugin($authname);
// The auth plugin's loginpage_hook() can eventually set $frm and/or $user.
$authplugin->loginpage_hook(); $authplugin->loginpage_hook();
} }
...@@ -146,7 +146,7 @@ if ($frm and isset($frm->username)) { // Login WITH ...@@ -146,7 +146,7 @@ if ($frm and isset($frm->username)) { // Login WITH
} }
if ($user) { if ($user) {
//user already supplied by aut plugin prelogin hook // The auth plugin has already provided the user via the loginpage_hook() called above.
} else if (($frm->username == 'guest') and empty($CFG->guestloginbutton)) { } else if (($frm->username == 'guest') and empty($CFG->guestloginbutton)) {
$user = false; /// Can't log in as guest if guest button is disabled $user = false; /// Can't log in as guest if guest button is disabled
$frm = false; $frm = false;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment