From 11f02af475a33600ed70a5a54c362d1ac50667d3 Mon Sep 17 00:00:00 2001 From: Marcel Folaron <47038998+marcelfolaron@users.noreply.github.com> Date: Sun, 28 Apr 2024 14:14:14 -0400 Subject: [PATCH] Add servername as fallback for http_host --- app/Core/Middleware/Auth.php | 1 - app/Core/Session.php | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/Core/Middleware/Auth.php b/app/Core/Middleware/Auth.php index dadaf49db..e2a4d11ff 100644 --- a/app/Core/Middleware/Auth.php +++ b/app/Core/Middleware/Auth.php @@ -6,7 +6,6 @@ use Leantime\Core\Eventhelpers; use Leantime\Core\Frontcontroller; use Leantime\Core\IncomingRequest; -use Leantime\Core\Theme; use Leantime\Domain\Auth\Services\Auth as AuthService; use Leantime\Domain\Projects\Services\Projects as ProjectsService; use Symfony\Component\HttpFoundation\RedirectResponse; diff --git a/app/Core/Session.php b/app/Core/Session.php index 82dcdc5ec..54e91c527 100644 --- a/app/Core/Session.php +++ b/app/Core/Session.php @@ -85,7 +85,7 @@ public function __construct( //test remote host info $session_string = ! $this->request instanceof CliRequest - ? self::get_client_ip() . $_SERVER['HTTP_HOST'] + ? self::get_client_ip() . $_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME'] : 'cli'; $testSessionHost = hash('sha1', $session_string . $this->sessionpassword); @@ -136,7 +136,7 @@ public static function getSID(): string private function makeSID(): void { $session_string = ! $this->request instanceof CliRequest - ? self::get_client_ip() . $_SERVER['HTTP_HOST'] + ? self::get_client_ip() . $_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME'] : 'cli'; $tmp = hash('sha1', mt_rand(32, 32) . $session_string . time()); @@ -169,8 +169,6 @@ public static function destroySession(): void ); } - - private static function get_client_ip() { $ipaddress = '';