Skip to content

Commit

Permalink
Add servername as fallback for http_host
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Apr 28, 2024
1 parent 739b5ec commit 11f02af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion app/Core/Middleware/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions app/Core/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -169,8 +169,6 @@ public static function destroySession(): void
);
}



private static function get_client_ip()
{
$ipaddress = '';
Expand Down

0 comments on commit 11f02af

Please sign in to comment.