mirror of
https://github.com/grocy/grocy.git
synced 2026-04-05 20:36:15 +02:00
Check if variable is set, more accurate error description
This commit is contained in:
parent
d82fafe722
commit
af24c402ec
|
|
@ -24,12 +24,19 @@ class ReverseProxyAuthMiddleware extends AuthMiddleware
|
||||||
|
|
||||||
if (GROCY_REVERSE_PROXY_AUTH_USE_ENV)
|
if (GROCY_REVERSE_PROXY_AUTH_USE_ENV)
|
||||||
{
|
{
|
||||||
|
if (!isset($_SERVER[GROCY_REVERSE_PROXY_AUTH_HEADER]))
|
||||||
|
{
|
||||||
|
// Variable is not set
|
||||||
|
throw new \Exception('ReverseProxyAuthMiddleware: ' . GROCY_REVERSE_PROXY_AUTH_HEADER . ' env variable is missing, could not be found in $_SERVER array.');
|
||||||
|
}
|
||||||
|
|
||||||
$username = $_SERVER[GROCY_REVERSE_PROXY_AUTH_HEADER];
|
$username = $_SERVER[GROCY_REVERSE_PROXY_AUTH_HEADER];
|
||||||
if (strlen($username) === 0)
|
if (strlen($username) === 0)
|
||||||
{
|
{
|
||||||
// Invalid configuration of Proxy
|
// Variable is empty
|
||||||
throw new \Exception('ReverseProxyAuthMiddleware: ' . GROCY_REVERSE_PROXY_AUTH_HEADER . ' header is missing or invalid');
|
throw new \Exception('ReverseProxyAuthMiddleware: ' . GROCY_REVERSE_PROXY_AUTH_HEADER . ' env variable is invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$username = $request->getHeader(GROCY_REVERSE_PROXY_AUTH_HEADER);
|
$username = $request->getHeader(GROCY_REVERSE_PROXY_AUTH_HEADER);
|
||||||
if (count($username) !== 1)
|
if (count($username) !== 1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user