Skip to content

Commit

Permalink
Dont error when stats update token is empty, instead throw unautorize…
Browse files Browse the repository at this point in the history
…d exception
  • Loading branch information
krazzer committed Aug 15, 2023
1 parent ff07f15 commit ed00b94
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Controllers/StatisticsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/Services/Cms/CmsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit ed00b94

Please sign in to comment.