]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14883 Password expiration check during login doesn't work after NTLM integration
authoriarenaza <iarenaza>
Sun, 18 May 2008 21:33:19 +0000 (21:33 +0000)
committeriarenaza <iarenaza>
Sun, 18 May 2008 21:33:19 +0000 (21:33 +0000)
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

index 3a3da1d449e1ba2fd03f3d3c3e17e0b09c6d86cc..062df4d979427a1c393a90f0500b1d880380725c 100644 (file)
@@ -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;