mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-07-30 00:23:39 +00:00
[Web] Add forced 2FA setup and password update enforcement
This commit is contained in:
@@ -36,7 +36,26 @@ if (isset($_SESSION['mailcow_cc_role']) && (isset($_SESSION['acl']['login_as'])
|
||||
|
||||
if (isset($_SESSION['mailcow_cc_role'])) {
|
||||
if (isset($_POST["set_tfa"])) {
|
||||
$had_pending_tfa_setup = !empty($_SESSION['pending_tfa_setup']);
|
||||
set_tfa($_POST);
|
||||
// After TFA setup during forced enrollment
|
||||
if ($had_pending_tfa_setup && empty($_SESSION['pending_tfa_setup'])) {
|
||||
if ($_SESSION['mailcow_cc_role'] === 'admin') {
|
||||
header("Location: /admin/dashboard");
|
||||
} elseif ($_SESSION['mailcow_cc_role'] === 'domainadmin') {
|
||||
header("Location: /domainadmin/mailbox");
|
||||
} elseif ($_SESSION['mailcow_cc_role'] === 'user') {
|
||||
// Check if user should go to SOGo or /user
|
||||
$user_details = mailbox("get", "mailbox_details", $_SESSION['mailcow_cc_username']);
|
||||
$is_dual = (!empty($_SESSION["dual-login"]["username"])) ? true : false;
|
||||
if (intval($user_details['attributes']['sogo_access']) == 1 && !$is_dual && getenv('SKIP_SOGO') != "y") {
|
||||
header("Location: /SOGo/so/");
|
||||
} else {
|
||||
header("Location: /user");
|
||||
}
|
||||
}
|
||||
exit();
|
||||
}
|
||||
}
|
||||
if (isset($_POST["unset_tfa_key"])) {
|
||||
unset_tfa_key($_POST);
|
||||
|
||||
Reference in New Issue
Block a user