]> git.mjollnir.org Git - moodle.git/commitdiff
Auth: Fix for error creating admin user (if you choose a new username). Also addres...
authordonal72 <donal72>
Sun, 28 Jan 2007 10:27:05 +0000 (10:27 +0000)
committerdonal72 <donal72>
Sun, 28 Jan 2007 10:27:05 +0000 (10:27 +0000)
auth/db/auth.php
auth/email/auth.php
auth/manual/auth.php
auth/none/auth.php
login/change_password.php
user/editadvanced.php

index 7714725605bf0d69ee597f8b1f532da5b76b791a..1bd81d96feb5fc50ce04a1d32bd41cbf4916e71d 100644 (file)
@@ -153,11 +153,11 @@ class auth_plugin_db {
     }
 
 
-    function user_update_password($username, $newpassword) {
+    function user_update_password($user, $newpassword) {
 
         global $CFG;
         if ($this->config->passtype === 'internal') {
-            return set_field('user', 'password', md5($newpassword), 'username', $username, 'mnethostid', $CFG->mnet_localhost_id);
+            return set_field('user', 'password', md5($newpassword), 'id', $user->id, 'mnethostid', $CFG->mnet_localhost_id);
         } else {
             // we should have never been called!
             return false;
index 0fba410f8f2f0ea38fab0abb9c14ac47886d9ec7..f91eb35ad5c24a6399c6d51d4024a999be919356 100644 (file)
@@ -68,8 +68,8 @@ class auth_plugin_email {
      * @return boolean result
      *
      */
-    function user_update_password($username, $newpassword) {
-        $user = get_complete_user_data('username', $username);
+    function user_update_password($user, $newpassword) {
+        $user = get_complete_user_data('id', $user->id);
         return update_internal_user_password($user, $newpassword);
     }
 
index 38f3275830f67c05f3ce8823a65f827acf1a9ce2..25b862392b598c359c2db1808e0f8e3eb036f488 100644 (file)
@@ -60,8 +60,8 @@ class auth_plugin_manual
      * @return boolean result
      *
      */
-    function user_update_password($username, $newpassword) {
-        $user = get_complete_user_data('username', $username);
+    function user_update_password($user, $newpassword) {
+        $user = get_complete_user_data('id', $user->id);
         return update_internal_user_password($user, $newpassword);
     }
 
index 3fcd2d62c2df2fc3eaf7a2a85a7255e795de5d19..b41fea5e90328645af58f499d0b107426857a723 100644 (file)
@@ -61,8 +61,8 @@ class auth_plugin_none {
      * @return boolean result
      *
      */
-    function user_update_password($username, $newpassword) {
-        $user = get_complete_user_data('username', $username);
+    function user_update_password($user, $newpassword) {
+        $user = get_complete_user_data('id', $user->id);
         return update_internal_user_password($user, $newpassword);
     }
 
index 0840ef3e6d795ed71d3def2f761c2d62e0b4f6e3..f9e55c4e120025e7a1c529a77574d521ca73fe30 100644 (file)
@@ -57,7 +57,7 @@
         // load the appropriate auth plugin
         $userauth = get_auth_plugin($user->auth);
         if ($userauth->can_change_password()){
-            if ($userauth->user_update_password($user->username, $data->newpassword1)) {
+            if ($userauth->user_update_password($user, $data->newpassword1)) {
                 // hash the $user->password field (without local db update)
                 update_internal_user_password($user, $data->newpassword1, false);
             } else {
index f159a31784189cb8e89dd271aae055e56ed890ba..bd4e2f28d8102ae6044a431350f70c096a23de47 100644 (file)
@@ -97,7 +97,7 @@
             if (!empty($usernew->newpassword)) {
                 if ($authplugin->can_change_password()) {
                     if (method_exists($authplugin, 'user_update_password')){
-                        if (!$authplugin->user_update_password($user->username, $usernew->newpassword)){
+                        if (!$authplugin->user_update_password($usernew, $usernew->newpassword)){
                             error('Failed to update password on external auth: ' . $usernew->auth .
                                     '. See the server logs for more details.');
                         }