From 95538dfba412730a25c6e2ae3d7340763bcb703b Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 13 Mar 2024 15:06:49 +0300 Subject: [PATCH] fix token in form --- lib/Alchemy/Phrasea/Controller/Controller.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Controller.php b/lib/Alchemy/Phrasea/Controller/Controller.php index 82b6c291e2..d0ad338f03 100644 --- a/lib/Alchemy/Phrasea/Controller/Controller.php +++ b/lib/Alchemy/Phrasea/Controller/Controller.php @@ -116,10 +116,12 @@ public function getAuthenticatedUser() 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)