fix tfa modal trigger from dav/eas login

This commit is contained in:
FreddleSpl0it 2022-09-01 09:53:08 +02:00
parent a161aa2c92
commit a40df1ff87

View File

@ -942,7 +942,8 @@ function check_login($user, $pass, $app_passwd_data = false) {
// password is not a app password
// check for tfa authenticators
$authenticators = get_tfa($user);
if (isset($authenticators['additional']) && is_array($authenticators['additional']) && count($authenticators['additional']) > 0) {
if (isset($authenticators['additional']) && is_array($authenticators['additional']) && count($authenticators['additional']) > 0 &&
$app_passwd_data['eas'] !== true && $app_passwd_data['dav'] !== true) {
// authenticators found, init TFA flow
$_SESSION['pending_mailcow_cc_username'] = $user;
$_SESSION['pending_mailcow_cc_role'] = "user";
@ -954,7 +955,7 @@ function check_login($user, $pass, $app_passwd_data = false) {
'msg' => array('logged_in_as', $user)
);
return "pending";
} else {
} else if (!isset($authenticators['additional']) || !is_array($authenticators['additional']) || count($authenticators['additional']) == 0) {
// no authenticators found, login successfull
// Reactivate TFA if it was set to "deactivate TFA for next login"
$stmt = $pdo->prepare("UPDATE `tfa` SET `active`='1' WHERE `username` = :user");