From 7cf66d652443cc37eba066adb1530648a3a68338 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 21 Sep 2004 09:35:33 +0000 Subject: [PATCH] FIxed bugs and tidied up --- login/change_password.php | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/login/change_password.php b/login/change_password.php index 71627c5613..8d6c10ec06 100644 --- a/login/change_password.php +++ b/login/change_password.php @@ -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 { @@ -38,23 +38,19 @@ // 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."); } } -- 2.39.5