From: skodak Date: Wed, 24 Sep 2008 17:00:49 +0000 (+0000) Subject: MDL-16365 domain restrictions are now optional when changing email address; merged... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=bff34a6747a958e68ae0ddb2dd293bc3f1cb1d38;p=moodle.git MDL-16365 domain restrictions are now optional when changing email address; merged from MOODLE_19_STABLE --- diff --git a/admin/settings/users.php b/admin/settings/users.php index 2ac82ab6d2..af666a44f7 100644 --- a/admin/settings/users.php +++ b/admin/settings/users.php @@ -27,6 +27,7 @@ if ($hassiteconfig get_string('authinstructions', 'auth'), '')); $temp->add(new admin_setting_configtext('allowemailaddresses', get_string('allowemailaddresses', 'admin'), get_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS)); $temp->add(new admin_setting_configtext('denyemailaddresses', get_string('denyemailaddresses', 'admin'), get_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS)); + $temp->add(new admin_setting_configcheckbox('verifychangedemail', get_string('verifychangedemail', 'admin'), get_string('configverifychangedemail', 'admin'), 1)); $temp->add(new admin_setting_configtext('recaptchapublickey', get_string('recaptchapublickey', 'admin'), get_string('configrecaptchapublickey', 'admin'), '', PARAM_NOTAGS)); $temp->add(new admin_setting_configtext('recaptchaprivatekey', get_string('recaptchaprivatekey', 'admin'), get_string('configrecaptchaprivatekey', 'admin'), '', PARAM_NOTAGS)); diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index 30de215f86..c73841bd44 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -255,6 +255,7 @@ $string['configunzip'] = 'Indicate the location of your unzip program (Unix only $string['configuseexternalyui'] = 'Instead of using local files, use online files available on Yahoo‘s servers. WARNING: This requires an internet connection, or no AJAX will work on your site.'; $string['configusetags'] = 'Should tags functionality across the site be enabled?'; $string['configvariables'] = 'Variables'; +$string['configverifychangedemail'] = 'Enables verification of changed email addresses using allowed and denied email domains settings. If this setting is disabled the domains are enforced only when creating new users.'; $string['configwarning'] = 'Be careful modifying these settings - strange values could cause problems.'; $string['configxmlstrictheaders'] = 'Set to on, each page will be generated using XML http headers and prolog, so browsers will show XHTML errors inline. This is only useful for developers.'; $string['configzip'] = 'Indicate the location of your zip program (Unix only, optional). If specified, this will be used to create zip archives on the server. If you leave this blank, then Moodle will use internal routines.'; @@ -808,6 +809,7 @@ $string['uuupdatefromfile'] = 'Override with file'; $string['uuupdatemissing'] = 'Fill in missing from file and defaults'; $string['uuupdatetype'] = 'Existing user details'; $string['validateerror'] = 'This value was not valid:'; +$string['verifychangedemail'] = 'Restrict domains when changing email'; $string['warningcurrentsetting'] = 'Invalid current value: $a'; $string['webproxy'] = 'Web proxy'; $string['webproxyinfo'] = 'Fill in following options if your Moodle server can not access internet directly. Internet access is required for download of environment data, language packs, RSS feeds, timezones, etc.
PHP cURL extension is highly recommended.'; diff --git a/user/edit_form.php b/user/edit_form.php index 8d849aa668..b18528d2e0 100644 --- a/user/edit_form.php +++ b/user/edit_form.php @@ -109,6 +109,13 @@ class user_edit_form extends moodleform { $errors['email'] = get_string('toomanybounces'); } + if (!empty($CFG->verifychangedemail) and !isset($errors['email']) and !has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM))) { + $errorstr = email_is_not_allowed($usernew->email); + if ($errorstr !== false) { + $errors['email'] = $errorstr; + } + } + /// Next the customisable profile fields $errors += profile_validation($usernew, $files); diff --git a/version.php b/version.php index 7e1fb701dd..81b54f7022 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2008092300; // YYYYMMDD = date of the last version bump + $version = 2008092400; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 dev (Build: 20080924)'; // Human-friendly version name