1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2025-01-08 04:05:03 +02:00

[Web] fix set_tfa for ldap users

This commit is contained in:
FreddleSpl0it 2024-02-20 11:34:01 +01:00
parent d22cafacc8
commit 3a1dcb3aaf
No known key found for this signature in database
GPG Key ID: 00E14E7634F4BEC5

View File

@ -1065,13 +1065,19 @@ function set_tfa($_data) {
// check mailbox confirm password
if ($access_denied === null) {
$stmt = $pdo->prepare("SELECT `password` FROM `mailbox`
$stmt = $pdo->prepare("SELECT `password`, `authsource` FROM `mailbox`
WHERE `username` = :username");
$stmt->execute(array(':username' => $username));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row) {
if (!verify_hash($row['password'], $_data["confirm_password"])) $access_denied = true;
else $access_denied = false;
if ($row['authsource'] == 'ldap'){
$iam_settings = identity_provider('get');
if (!ldap_mbox_login($username, $row['password'], $iam_settings)) $access_denied = true;
else $access_denied = false;
} else {
if (!verify_hash($row['password'], $_data["confirm_password"])) $access_denied = true;
else $access_denied = false;
}
}
}