Merging from HEAD:
Fix for bug 4371 (also SC#199): Now manually created users with admin privileges and force change password cannot change their username with impunity.
This commit is contained in:
@@ -14,9 +14,8 @@
|
||||
if (empty($USER->preference['auth_forcepasswordchange'])) { // Don't redirect if they just got sent here
|
||||
require_login($id);
|
||||
}
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
validate_form($frm, $err);
|
||||
|
||||
check_for_restricted_user($frm->username);
|
||||
@@ -144,9 +143,18 @@ function validate_form($frm, &$err) {
|
||||
if (!isadmin() and empty($frm->password)){
|
||||
$err->password = get_string('missingpassword');
|
||||
} else {
|
||||
//require non adminusers to give valid password
|
||||
if (!isadmin() && !authenticate_user_login($frm->username, $frm->password)){
|
||||
$err->password = get_string('wrongpassword');
|
||||
if (!isadmin()) {
|
||||
//require non adminusers to give valid password
|
||||
if(!authenticate_user_login($frm->username, $frm->password)) {
|
||||
$err->password = get_string('wrongpassword');
|
||||
}
|
||||
}
|
||||
else {
|
||||
// don't allow anyone to change the primary admin's password
|
||||
$mainadmin = get_admin();
|
||||
if($frm->username == $mainadmin->username) {
|
||||
$err->password = get_string('adminprimarynoedit');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user