]> git.mjollnir.org Git - moodle.git/commitdiff
FIxed bugs and tidied up
authormoodler <moodler>
Tue, 21 Sep 2004 09:35:33 +0000 (09:35 +0000)
committermoodler <moodler>
Tue, 21 Sep 2004 09:35:33 +0000 (09:35 +0000)
login/change_password.php

index 71627c5613e16282b8866db43f50e6d9097b9e70..8d6c10ec061dcc39a40cc10b8aa7739831ddb4a6 100644 (file)
@@ -28,7 +28,7 @@
                 error("Can't change guest password!");
             }
             
-            if(is_internal_auth($user)){
+            if (is_internal_auth($user->auth)){
                 if (set_field("user", "password", $password, "username", $username)) {
                     $user->password = $password;
                 } else {
                 // the relevant auth libs should be loaded already 
                 // as validate_form() calls authenticate_user_login()
                 // check that we allow changes through moodle
-                if(isset($CFG->{'auth_'. $user->auth.'_stdchangepassword'}) && $CFG->{'auth_'. $user->auth.'_stdchangepassword'}){
-                       if(function_exists('auth_user_update_password')){
-                           // note that we pass cleartext password 
-                           if(auth_user_update_password($user->username, $frm->newpassword1)){
-                               $user->password = $password;
-                           } else {
-                               error("Could not set the new password");
-                           }
-                       } else {
-
-                           error_log("External Authentication " . $user->auth . 
-                                     ' is set to use standard change password interface ' .
-                                     ' but auth_user_update_password() is missing.');
-                           error('The authentication module is misconfigured'); 
-                       } 
+                if (!empty($CFG->{'auth_'. $user->auth.'_stdchangepassword'})) {
+                    if (function_exists('auth_user_update_password')){
+                        // note that we pass cleartext password 
+                        if (auth_user_update_password($user->username, $frm->newpassword1)){
+                            $user->password = $password;
+                        } else {
+                            error('Could not set the new password');
+                        }
+                    } else {
+                        error('The authentication module is misconfigured (missing auth_user_update_password)'); 
+                    } 
                 } else {
-                      error("You are cannot change you password this way.");
+                    error("You cannot change your password this way.");
                 }
             }