MDL-58038 email: make sure all allowedemaildomain entries are respected
Fixes a bug with exploding the config var, in which trailing carriage returns were causing string matches to fail.
This commit is contained in:
+1
-1
@@ -5812,7 +5812,7 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '',
|
||||
|
||||
$alloweddomains = null;
|
||||
if (!empty($CFG->allowedemaildomains)) {
|
||||
$alloweddomains = explode(PHP_EOL, $CFG->allowedemaildomains);
|
||||
$alloweddomains = array_map('trim', explode("\n", $CFG->allowedemaildomains));
|
||||
}
|
||||
|
||||
// Email will be sent using no reply address.
|
||||
|
||||
@@ -2793,7 +2793,7 @@ class core_moodlelib_testcase extends advanced_testcase {
|
||||
$user1 = $this->getDataGenerator()->create_user(array('maildisplay' => 1));
|
||||
$user2 = $this->getDataGenerator()->create_user(array('maildisplay' => 1));
|
||||
$user3 = $this->getDataGenerator()->create_user(array('maildisplay' => 0));
|
||||
set_config('allowedemaildomains', 'example.com');
|
||||
set_config('allowedemaildomains', "example.com\r\nmoodle.org");
|
||||
|
||||
$subject = 'subject';
|
||||
$messagetext = 'message text';
|
||||
|
||||
Reference in New Issue
Block a user