mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-14883 Password expiration check during login doesn't work after NTLM integration
Forward ported from MOODLE_19_STABLE. As part of the NTLM integration work, we moved some login code from login/index.php to lib/moodlelib.php (function complete_user_login()). This broke the password expiration check code, as we moved the $userauth variable to complete_user_login(), and we also need it in login/index.php later. Add the missing variable and related code to get a suitable password change url. Also remove the now inexistant $focus variable from the call to print_header().
This commit is contained in:
parent
907a375942
commit
e6d4c2f868
@ -185,15 +185,21 @@ httpsrequired();
|
||||
|
||||
/// check if user password has expired
|
||||
/// Currently supported only for ldap-authentication module
|
||||
$userauth = get_auth_plugin($USER->auth);
|
||||
if (!empty($userauth->config->expiration) and $userauth->config->expiration == 1) {
|
||||
if ($userauth->can_change_password()) {
|
||||
$passwordchangeurl = $userauth->change_password_url();
|
||||
} else {
|
||||
$passwordchangeurl = $CFG->httpswwwroot.'/login/change_password.php';
|
||||
}
|
||||
$days2expire = $userauth->password_expire($USER->username);
|
||||
if (intval($days2expire) > 0 && intval($days2expire) < intval($userauth->config->expiration_warning)) {
|
||||
print_header("$site->fullname: $loginsite", "$site->fullname", $navigation, $focus, "", true, "<div class=\"langmenu\">$langmenu</div>");
|
||||
print_header("$site->fullname: $loginsite", "$site->fullname", $navigation, '', '', true, "<div class=\"langmenu\">$langmenu</div>");
|
||||
notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo);
|
||||
print_footer();
|
||||
exit;
|
||||
} elseif (intval($days2expire) < 0 ) {
|
||||
print_header("$site->fullname: $loginsite", "$site->fullname", $navigation, $focus, "", true, "<div class=\"langmenu\">$langmenu</div>");
|
||||
print_header("$site->fullname: $loginsite", "$site->fullname", $navigation, '', '', true, "<div class=\"langmenu\">$langmenu</div>");
|
||||
notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo);
|
||||
print_footer();
|
||||
exit;
|
||||
|
Loading…
x
Reference in New Issue
Block a user