Update sogo-auth.php

Consistency again. :)

I moved the prerequisites require_once to the top, ok?
master
André Peters 2019-02-23 22:26:41 +01:00 committed by GitHub
parent 0c8f217f49
commit 88fbc6bf16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 43 additions and 42 deletions

View File

@ -1,4 +1,5 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
/**
* currently disabled: we could add auth_request to ningx sogo_eas.template
@ -35,8 +36,8 @@ $session_variable = 'sogo-sso-user';
if (!$ALLOW_ADMIN_EMAIL_LOGIN) {
header("Location: /");
exit;
} else if (isset($_GET['login'])) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
}
elseif (isset($_GET['login'])) {
if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['acl']['login_as'] == "1") {
$login = html_entity_decode(rawurldecode($_GET["login"]));
if (filter_var($login, FILTER_VALIDATE_EMAIL)) {
@ -49,9 +50,9 @@ if (!$ALLOW_ADMIN_EMAIL_LOGIN) {
}
header("Location: /");
exit;
} else {
}
else {
// this is an nginx auth_request call, we check for an existing sogo-sso-user session variable
session_start();
$username = "";
if (isset($_SESSION[$session_variable]) && filter_var($_SESSION[$session_variable], FILTER_VALIDATE_EMAIL)) {
$username = $_SESSION[$session_variable];