mirror of
https://github.com/grocy/grocy.git
synced 2025-08-15 02:04:38 +00:00
Don't expose username when not logged in
This commit is contained in:
@@ -21,6 +21,7 @@ class SessionAuthMiddleware extends BaseMiddleware
|
||||
|
||||
if ($routeName === 'root' || $this->ApplicationService->IsDemoInstallation())
|
||||
{
|
||||
define('AUTHENTICATED', $this->ApplicationService->IsDemoInstallation());
|
||||
$response = $next($request, $response);
|
||||
}
|
||||
else
|
||||
@@ -28,10 +29,12 @@ class SessionAuthMiddleware extends BaseMiddleware
|
||||
$sessionService = new SessionService();
|
||||
if ((!isset($_COOKIE[$this->SessionCookieName]) || !$sessionService->IsValidSession($_COOKIE[$this->SessionCookieName])) && $routeName !== 'login')
|
||||
{
|
||||
define('AUTHENTICATED', false);
|
||||
$response = $response->withRedirect($this->AppContainer->UrlManager->ConstructUrl('/login'));
|
||||
}
|
||||
else
|
||||
{
|
||||
define('AUTHENTICATED', $routeName !== 'login');
|
||||
$response = $next($request, $response);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user