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,10 +116,12 @@ class Controller
public function setSessionFormToken($formName)
{
$randomValue = bin2hex(random_bytes(35));
$this->app['session']->set($formName.'_token', $randomValue);
if (!$this->app['session']->has($formName.'_token')) {
$randomValue = bin2hex(random_bytes(35));
$this->app['session']->set($formName.'_token', $randomValue);
return $randomValue;
return $randomValue;
}
}
public function getSessionFormToken($formName)