MDL-20962 fixed forced new passowrd logic

This commit is contained in:
Petr Skoda
2009-11-25 17:05:28 +00:00
parent 6d558e7705
commit 676fff3fa1
+6 -4
View File
@@ -149,8 +149,7 @@ if ($formdata = $mform->is_cancelled()) {
$renames = 0;
$renameerrors = 0;
$usersskipped = 0;
$forcechangepassword = 0;
$weakpasswords = 0;
// caches
$ccache = array(); // course cache - do not fetch all courses here, we will not probably use them all anyway!
@@ -192,6 +191,8 @@ if ($formdata = $mform->is_cancelled()) {
$upt->track('line', $linenum);
$forcechangepassword = false;
$user = new object();
// by default, use the local mnet id (this may be changed in the file)
$user->mnethostid = $CFG->mnet_localhost_id;
@@ -204,7 +205,8 @@ if ($formdata = $mform->is_cancelled()) {
if ($value !== '') {
$user->password = hash_internal_user_password($value);
if (!empty($CFG->passwordpolicy) and !check_password_policy($value, $errmsg)) {
$forcechangepassword++;
$forcechangepassword = true;
$weakpasswords++;
}
}
} else {
@@ -707,7 +709,7 @@ if ($formdata = $mform->is_cancelled()) {
if ($usersskipped) {
echo get_string('usersskipped', 'admin').': '.$usersskipped.'<br />';
}
echo get_string('usersweakpassword', 'admin').': '.$forcechangepassword.'<br />';
echo get_string('usersweakpassword', 'admin').': '.$weakpasswords.'<br />';
echo get_string('errors', 'admin').': '.$userserrors.'</p>';
print_box_end();