Changes for #176

This commit is contained in:
djmaze 2021-12-23 12:26:39 +01:00
parent 6465c95a91
commit b80e62adfc

View file

@ -32,8 +32,15 @@ trait Admin
private function getAdminAuthKey() : string
{
$aAdminHash = Utils::DecodeKeyValuesQ(Utils::GetCookie(static::$AUTH_ADMIN_TOKEN_KEY, ''));
return (empty($aAdminHash[1]) || 'token' !== $aAdminHash[0]) ? '' : $aAdminHash[1];
$cookie = Utils::GetCookie(static::$AUTH_ADMIN_TOKEN_KEY, '');
if ($cookie) {
$aAdminHash = Utils::DecodeKeyValuesQ($cookie);
if (!empty($aAdminHash[1]) && 'token' === $aAdminHash[0]) {
return $aAdminHash[1];
}
Utils::ClearCookie(static::$AUTH_ADMIN_TOKEN_KEY);
}
return '';
}
private function setAdminAuthToken(string $sToken) : void