mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-01-26 07:07:14 +00:00
Merge branch 'staging' into feat/valkey
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
<?php
|
||||
// Start session
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||
session_name($SESSION_NAME);
|
||||
ini_set("session.cookie_httponly", 1);
|
||||
ini_set("session.cookie_samesite", $SESSION_SAMESITE_POLICY);
|
||||
ini_set('session.gc_maxlifetime', $SESSION_LIFETIME);
|
||||
}
|
||||
|
||||
$_SESSION['access_all_exception'] = '0';
|
||||
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
|
||||
strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == "https") {
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||
@@ -94,16 +98,33 @@ if (isset($_POST["logout"])) {
|
||||
if (isset($_SESSION["dual-login"])) {
|
||||
$_SESSION["mailcow_cc_username"] = $_SESSION["dual-login"]["username"];
|
||||
$_SESSION["mailcow_cc_role"] = $_SESSION["dual-login"]["role"];
|
||||
unset($_SESSION['sogo-sso-user-allowed']);
|
||||
unset($_SESSION['sogo-sso-pass']);
|
||||
unset($_SESSION["dual-login"]);
|
||||
header("Location: /mailbox");
|
||||
if ($_SESSION["mailcow_cc_role"] == "admin"){
|
||||
header("Location: /admin/mailbox");
|
||||
} elseif ($_SESSION["mailcow_cc_role"] == "domainadmin") {
|
||||
header("Location: /domainadmin/mailbox");
|
||||
} else {
|
||||
header("Location: /");
|
||||
}
|
||||
exit();
|
||||
}
|
||||
else {
|
||||
$role = $_SESSION["mailcow_cc_role"];
|
||||
session_regenerate_id(true);
|
||||
session_unset();
|
||||
session_destroy();
|
||||
session_write_close();
|
||||
header("Location: /");
|
||||
if ($role == "admin") {
|
||||
header("Location: /admin");
|
||||
}
|
||||
elseif ($role == "domainadmin") {
|
||||
header("Location: /domainadmin");
|
||||
}
|
||||
else {
|
||||
header("Location: /");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user