Commit 95398e81 authored by Lisa Seeto's avatar Lisa Seeto
Browse files

Bug 1813101: use correct email syntax for noreply address



If the default noreply email address is invalid set it to a valid format
and make sure warnings still display to user

behatnotneeded

Change-Id: I390d2d62ac39aef49144a69d4edb1f0a3918fd8e
Signed-off-by: default avatarLisa Seeto <lisaseeto@catalyst.net.nz>
parent 8400b75d
......@@ -278,8 +278,12 @@ if ($CFG->sslproxy === false && isset($_SERVER['REMOTE_ADDR']) && (!isset($_SERV
}
if (!isset($CFG->noreplyaddress) && isset($CFG->wwwroot)) {
$noreplyaddress = 'noreply@' . parse_url($CFG->wwwroot, PHP_URL_HOST);
try {
set_config('noreplyaddress', $noreplyaddress);
if (!sanitize_email($noreplyaddress)) {
$noreplyaddress = 'noreply@example.org';
}
set_config('noreplyaddress', $noreplyaddress);
}
catch (Exception $e) {
// Do nothing again, same reason as above
......
......@@ -1571,7 +1571,7 @@ function site_warnings() {
}
// Check noreply address is valid.
if (!sanitize_email(get_config('noreplyaddress'))) {
if (!sanitize_email(get_config('noreplyaddress')) || get_config('noreplyaddress') == 'noreply@example.org') {
$warnings[] = get_string('noreplyaddressmissingorinvalid', 'error', get_config('wwwroot') . 'admin/site/options.php?fs=emailsettings');
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment