MDL-41176 do not set description and pw fields in $USER when editing own profile
This commit is contained in:
+7
-3
@@ -256,12 +256,16 @@ if ($usernew = $userform->get_data()) {
|
||||
}
|
||||
}
|
||||
|
||||
// reload from db
|
||||
$usernew = $DB->get_record('user', array('id'=>$user->id));
|
||||
// Reload from db, we need new full name on this page if we do not redirect.
|
||||
$user = $DB->get_record('user', array('id'=>$user->id), '*', MUST_EXIST);
|
||||
|
||||
if ($USER->id == $user->id) {
|
||||
// Override old $USER session variable if needed
|
||||
foreach ((array)$usernew as $variable => $value) {
|
||||
foreach ((array)$user as $variable => $value) {
|
||||
if ($variable === 'description' or $variable === 'password') {
|
||||
// These are not set for security nad perf reasons.
|
||||
continue;
|
||||
}
|
||||
$USER->$variable = $value;
|
||||
}
|
||||
// preload custom fields
|
||||
|
||||
@@ -240,6 +240,10 @@ if ($usernew = $userform->get_data()) {
|
||||
if ($user->id == $USER->id) {
|
||||
// Override old $USER session variable
|
||||
foreach ((array)$usernew as $variable => $value) {
|
||||
if ($variable === 'description' or $variable === 'password') {
|
||||
// These are not set for security nad perf reasons.
|
||||
continue;
|
||||
}
|
||||
$USER->$variable = $value;
|
||||
}
|
||||
// preload custom fields
|
||||
|
||||
Reference in New Issue
Block a user