You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: interface/web/login/otp.php
+17-5Lines changed: 17 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -157,13 +157,25 @@ function finish_2fa_success($msg = '') {
157
157
$app->ispcmail->setOptions($mail_config);
158
158
}
159
159
160
-
$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']);
161
-
if (!empty($clientuser['email'])) {
162
-
$email_to = $clientuser['email'];
160
+
$sys_user = $app->db->queryOneRecord('SELECT otp_data FROM sys_user WHERE userid = ?', $_SESSION['s_pending']['user']['userid']);
161
+
$data = json_decode($sys_user['otp_data'], TRUE);
162
+
163
+
if (!empty($data['otp_email_override'] )) {
164
+
// Handle otp_email_override.
165
+
$email_to = $data['otp_email_override'];
163
166
}
164
167
else {
165
-
// Admin users are not related to a client, thus use the globally configured email address.
166
-
$email_to = $mail_config['admin_mail'];
168
+
$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']);
169
+
if (!empty($clientuser['email'])) {
170
+
$email_to = $clientuser['email'];
171
+
}
172
+
elseif(!empty($mail_config['admin_mail'])) {
173
+
// Admin users are not related to a client, thus use the globally configured email address.
174
+
$email_to = $mail_config['admin_mail'];
175
+
}
176
+
else {
177
+
$app->error('No mail address available to sent an OTP code to.', 'index.php');
0 commit comments