MDL-10498: Apostrophe / Quote in username or email breaks profile update
Author: Aaron Barnes <[email protected]>
This commit is contained in:
+1
-1
@@ -109,7 +109,7 @@ class user_edit_form extends moodleform {
|
||||
// validate email
|
||||
if (!validate_email($usernew->email)) {
|
||||
$err['email'] = get_string('invalidemail');
|
||||
} else if (($usernew->email !== $user->email) and record_exists('user', 'email', $usernew->email, 'mnethostid', $CFG->mnet_localhost_id)) {
|
||||
} else if ((stripslashes($usernew->email) !== $user->email) and record_exists('user', 'email', $usernew->email, 'mnethostid', $CFG->mnet_localhost_id)) {
|
||||
$err['email'] = get_string('emailexists');
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ class user_editadvanced_form extends moodleform {
|
||||
}
|
||||
}
|
||||
|
||||
if (!$user or $user->email !== $usernew->email) {
|
||||
if (!$user or $user->email !== stripslashes($usernew->email)) {
|
||||
if (!validate_email($usernew->email)) {
|
||||
$err['email'] = get_string('invalidemail');
|
||||
} else if (record_exists('user', 'email', $usernew->email, 'mnethostid', $CFG->mnet_localhost_id)) {
|
||||
|
||||
Reference in New Issue
Block a user