Skip to content

Commit

Permalink
secure locale cookie (#4333)
Browse files Browse the repository at this point in the history
  • Loading branch information
aynsix authored Jul 12, 2023
1 parent 12851c1 commit 8d60402
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Alchemy/Phrasea/Controller/Root/RootController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function getRoot()
public function setLocale($locale)
{
$response = $this->app->redirectPath('root');
$response->headers->setCookie(new Cookie('locale', $locale));
$response->headers->setCookie(new Cookie('locale', $locale, 0, '/', null, true, false));

$authenticatedUser = $this->getAuthenticatedUser();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function addLocaleCookie(FilterResponseEvent $event)
$cookies = $event->getRequest()->cookies;

if (isset($this->locale) && (false === $cookies->has('locale') || $cookies->get('locale') !== $this->locale)) {
$event->getResponse()->headers->setCookie(new Cookie('locale', $this->locale, 0, '/', null, false, false));
$event->getResponse()->headers->setCookie(new Cookie('locale', $this->locale, 0, '/', null, true, false));
}
}
}

0 comments on commit 8d60402

Please sign in to comment.