2
0
André Peters 6 жил өмнө
parent
commit
4482aee747

+ 6 - 5
data/web/sogo-auth.php

@@ -1,10 +1,9 @@
 <?php
 <?php
-require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
 
 
 /**
 /**
- * currently disabled: we could add auth_request to ningx sogo_eas.template
- * but this seems to be not required with the postfix allow_real_nets option
- */
+* currently disabled: we could add auth_request to ningx sogo_eas.template
+* but this seems to be not required with the postfix allow_real_nets option
+*/
 /*
 /*
 if (substr($_SERVER['HTTP_X_ORIGINAL_URI'], 0, 28) === "/Microsoft-Server-ActiveSync") {
 if (substr($_SERVER['HTTP_X_ORIGINAL_URI'], 0, 28) === "/Microsoft-Server-ActiveSync") {
   require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
   require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
@@ -38,6 +37,7 @@ if (!$ALLOW_ADMIN_EMAIL_LOGIN) {
   exit;
   exit;
 }
 }
 elseif (isset($_GET['login'])) {
 elseif (isset($_GET['login'])) {
+  require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
   if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['acl']['login_as'] == "1") {
   if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['acl']['login_as'] == "1") {
     $login = html_entity_decode(rawurldecode($_GET["login"]));
     $login = html_entity_decode(rawurldecode($_GET["login"]));
     if (filter_var($login, FILTER_VALIDATE_EMAIL)) {
     if (filter_var($login, FILTER_VALIDATE_EMAIL)) {
@@ -53,9 +53,10 @@ elseif (isset($_GET['login'])) {
 }
 }
 else {
 else {
   // this is an nginx auth_request call, we check for an existing sogo-sso-user session variable
   // this is an nginx auth_request call, we check for an existing sogo-sso-user session variable
+  session_start();
   $username = "";
   $username = "";
   if (isset($_SESSION[$session_variable]) && filter_var($_SESSION[$session_variable], FILTER_VALIDATE_EMAIL)) {
   if (isset($_SESSION[$session_variable]) && filter_var($_SESSION[$session_variable], FILTER_VALIDATE_EMAIL)) {
-    $username = $_SESSION[$session_variable];
+      $username = $_SESSION[$session_variable];
   }
   }
   // if username is empty, SOGo will display the normal login form
   // if username is empty, SOGo will display the normal login form
   header("X-Username: $username");
   header("X-Username: $username");