Skip to content
Snippets Groups Projects
Commit 7dca1ae2 authored by Andy Hubert's avatar Andy Hubert Committed by Ryan Smith
Browse files

fix: Validates emails before using them to identify users. (#229)

parent 2da2e117
No related branches found
No related tags found
No related merge requests found
......@@ -19,8 +19,9 @@ defined('MOODLE_INTERNAL') || die();
function get_user(array $config, \stdClass $user) {
$fullname = get_full_name($user);
$hasvalidemail = filter_var($user->email, FILTER_VALIDATE_EMAIL);
if (array_key_exists('send_mbox', $config) && $config['send_mbox'] == true) {
if (array_key_exists('send_mbox', $config) && $config['send_mbox'] == true && $hasvalidemail) {
return [
'name' => $fullname,
'mbox' => 'mailto:' . $user->email,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment