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.
This commit is contained in:
David Mudrák 2018-11-15 20:27:58 +01:00
parent 208950cff0
commit 667f564b4d

View File

@ -69,13 +69,13 @@ if (!empty($SESSION->has_timed_out)) {
$session_has_timed_out = false;
}
/// auth plugins may override these - SSO anyone?
$frm = false;
$user = false;
$authsequence = get_enabled_auth_plugins(true); // auths, in sequence
foreach($authsequence as $authname) {
$authplugin = get_auth_plugin($authname);
// The auth plugin's loginpage_hook() can eventually set $frm and/or $user.
$authplugin->loginpage_hook();
}
@ -134,7 +134,7 @@ if ($frm and isset($frm->username)) { // Login WITH
}
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)) {
$user = false; /// Can't log in as guest if guest button is disabled
$frm = false;