mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Fix some form validation problems (closes #36)
This commit is contained in:
@@ -49,12 +49,20 @@ class ApiKeyAuthMiddleware extends BaseMiddleware
|
||||
define('GROCY_AUTHENTICATED', false);
|
||||
$response = $response->withStatus(401);
|
||||
}
|
||||
else
|
||||
elseif ($validApiKey)
|
||||
{
|
||||
$user = $apiKeyService->GetUserByApiKey($request->getHeaderLine($this->ApiKeyHeaderName));
|
||||
define('GROCY_AUTHENTICATED', true);
|
||||
define('GROCY_USER_ID', $user->id);
|
||||
|
||||
$response = $next($request, $response);
|
||||
}
|
||||
elseif ($validSession)
|
||||
{
|
||||
$user = $sessionService->GetUserBySessionKey($_COOKIE[$this->SessionCookieName]);
|
||||
define('GROCY_AUTHENTICATED', true);
|
||||
define('GROCY_USER_ID', $user->id);
|
||||
|
||||
$response = $next($request, $response);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user