MDL-41176 do not set description and pw fields in $USER when editing own profile

This commit is contained in:
Petr Škoda
2013-09-27 10:33:48 +02:00
parent e113214618
commit cf361a9501
2 changed files with 11 additions and 3 deletions
+7 -3
View File
@@ -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
+4
View File
@@ -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