Skip to content

Commit

Permalink
MDL-18006 MDL-18807 MDL-20853 do not force changing of admin password…
Browse files Browse the repository at this point in the history
…s if password not stored in Moodle
  • Loading branch information
skodak committed Nov 17, 2009
1 parent 5c66ab3 commit 8993cd4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/db/upgrade.php
Expand Up @@ -3213,7 +3213,7 @@ function xmldb_main_upgrade($oldversion=0) {
}

// Force administrators to change password on next login
$sql = "SELECT DISTINCT u.id, u.firstname, u.lastname, u.picture, u.imagealt, u.email
$sql = "SELECT DISTINCT u.id, u.firstname, u.lastname, u.picture, u.imagealt, u.email, u.password
FROM {$CFG->prefix}role_capabilities rc
JOIN {$CFG->prefix}role_assignments ra ON (ra.contextid = rc.contextid AND ra.roleid = rc.roleid)
JOIN {$CFG->prefix}user u ON u.id = ra.userid
Expand All @@ -3224,6 +3224,10 @@ function xmldb_main_upgrade($oldversion=0) {

$adminusers = get_records_sql($sql);
foreach ($adminusers as $adminuser) {
if ($adminuser->password === 'not cached') {
// no need to change password if stored only outside of moodle - most probably ldap auth
continue;
}
if ($preference = get_record('user_preferences', 'userid', $adminuser->id, 'name', 'auth_forcepasswordchange')) {
if ($preference->value == '1') {
continue;
Expand Down

0 comments on commit 8993cd4

Please sign in to comment.