-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
4.5.1
-
None
-
MOODLE_405_STABLE
When a user has already registered with a domain and then we restrict the new user to this domain. Exisitng user cannot modify his profile becaus he has a forbidden address.
Here are the reproduction steps :
- Register a new user with example.com
- Set the denied domain to example.com
- Set the Restrict domains when changing email to yes
- log as the user created in first step
- Edit your profile and try to change any field. You then have the error message that your email is forbidden.
This happens also when you use sso to log user from a domain and restrict thois domain at signup. The sso users can login but they can't edit their profile anymore.
The patch is pretty simple :
//
|
diff --git a/user/edit_form.php b/user/edit_form.php
|
index 595c733389e..08adf790658 100644 |
--- a/user/edit_form.php
|
+++ b/user/edit_form.php
|
@@ -228,7 +228,7 @@ class user_edit_form extends moodleform { |
$errors['email'] = get_string('toomanybounces'); |
}
|
|
- if (isset($usernew->email) and !empty($CFG->verifychangedemail) and !isset($errors['email']) and !has_capability('moodle/user:update', context_system::instance())) { |
+ if (isset($usernew->email) and $usernew->email != $user->email and !empty($CFG->verifychangedemail) and !isset($errors['email']) and !has_capability('moodle/user:update', context_system::instance())) { |
$errorstr = email_is_not_allowed($usernew->email);
|
if ($errorstr !== false) { |
$errors['email'] = $errorstr; |
This activates the email validity check only if user want to change their email.
- duplicates
-
MDL-80147 "Restrict domains when changing email" also blocks when the address is not modified
- Open