Skip to content

Commit

Permalink
Updated preventpassindb to work properly.
Browse files Browse the repository at this point in the history
(sometimes db password wasn't being updated
to 'not cached' properly).
  • Loading branch information
stronk7 committed Jul 15, 2005
1 parent 5d78942 commit 8886ee0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/moodlelib.php
Expand Up @@ -2390,14 +2390,13 @@ function authenticate_user_login($username, $password) {
if (empty($user->auth)) { // For some reason auth isn't set yet
set_field('user', 'auth', $auth, 'username', $username);
}
if ($md5password <> $user->password) { // Update local copy of password for reference
if(empty($CFG->{$user->auth.'_preventpassindb'})){ //Prevent passwords in Moodle's DB
set_field('user', 'password', $md5password, 'username', $username);
} else {
if ($user->password != 'not cached') {
set_field('user', 'password', 'not cached', 'username', $username); //Unusable password
}
}
if (empty($CFG->{$user->auth.'_preventpassindb'})){ //Calculate the password to update
$passfield = $md5password;
} else {
$passfield = 'not cached';
}
if ($passfield <> $user->password) { // Update local copy of password for reference
set_field('user', 'password', $passfield, 'username', $username); //Update password
}
if (!is_internal_auth()) { // update user record from external DB
$user = update_user_record($username);
Expand Down

0 comments on commit 8886ee0

Please sign in to comment.