From c7f61ad13d09df86ac4cd3500692d4ea7acf7e93 Mon Sep 17 00:00:00 2001 From: Herman van Rink <rink@initfour.nl> Date: Mon, 28 Mar 2022 20:25:29 +0200 Subject: [PATCH] Admin users are not related to a client, thus use the globally configured email address. --- interface/web/login/otp.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/interface/web/login/otp.php b/interface/web/login/otp.php index 66381d2947..27a745038c 100644 --- a/interface/web/login/otp.php +++ b/interface/web/login/otp.php @@ -151,7 +151,13 @@ if($_SESSION['otp']['type'] == 'email') { } $clientuser = $app->db->queryOneRecord('SELECT email FROM sys_user u LEFT JOIN client c ON (u.client_id=c.client_id) WHERE u.userid = ?', $_SESSION['s_pending']['user']['userid']); - $email_to = $clientuser['email']; + if (!empty($clientuser['email'])) { + $email_to = $clientuser['email']; + } + else { + // Admin users are not related to a client, thus use the globally configured email address. + $email_to = $mail_config['admin_mail']; + } $app->ispcmail->setSender($mail_config['admin_mail'], $mail_config['admin_name']); $app->ispcmail->setSubject($wb['otp_code_email_subject_txt']); -- GitLab