diff --git a/src/Controllers/StatisticsController.php b/src/Controllers/StatisticsController.php index bd9a4376..c1dae6af 100644 --- a/src/Controllers/StatisticsController.php +++ b/src/Controllers/StatisticsController.php @@ -49,11 +49,11 @@ public function getVisitorsAction(): string } /** - * Update statistics data from google analytics + * Update statistics data from Google Analytics */ public function updateAction() { - $token = $this->request->getPost('token'); + $token = (string) $this->request->getPost('token', 'string'); $this->cmsService->checkSecurityToken($token); diff --git a/src/Services/Cms/CmsService.php b/src/Services/Cms/CmsService.php index 7b34754f..cfb3dafe 100644 --- a/src/Services/Cms/CmsService.php +++ b/src/Services/Cms/CmsService.php @@ -195,7 +195,7 @@ public function createSecurityToken(): string */ public function checkSecurityToken(string $token) { - if ( ! $this->keyValue->has($token)) { + if ( ! $token || ! $this->keyValue->has($token)) { throw new UnauthorizedException(); }