From e6d4c2f868e915cebd352d06b4066208d9f2888b Mon Sep 17 00:00:00 2001 From: iarenaza Date: Sun, 18 May 2008 21:33:19 +0000 Subject: [PATCH] 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(). --- login/index.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/login/index.php b/login/index.php index 3a3da1d449e..062df4d9794 100644 --- a/login/index.php +++ b/login/index.php @@ -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, "
$langmenu
"); + print_header("$site->fullname: $loginsite", "$site->fullname", $navigation, '', '', true, "
$langmenu
"); 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, "
$langmenu
"); + print_header("$site->fullname: $loginsite", "$site->fullname", $navigation, '', '', true, "
$langmenu
"); notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo); print_footer(); exit;