PHRAS-4038 fix token in form (#4484)

This commit is contained in:
Aina Sitraka
2024-03-19 16:11:57 +03:00
committed by GitHub
parent f1b81219cd
commit a3160ffec8

View File

@@ -116,11 +116,13 @@ class Controller
public function setSessionFormToken($formName) public function setSessionFormToken($formName)
{ {
if (!$this->app['session']->has($formName.'_token')) {
$randomValue = bin2hex(random_bytes(35)); $randomValue = bin2hex(random_bytes(35));
$this->app['session']->set($formName.'_token', $randomValue); $this->app['session']->set($formName.'_token', $randomValue);
return $randomValue; return $randomValue;
} }
}
public function getSessionFormToken($formName) public function getSessionFormToken($formName)
{ {