}
- 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;
* @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);
}
* @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);
}
* @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);
}
// 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 {
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.');
}