mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
Issue #437: Fixed CSRF-token returning null on first refresh after cookies are removed.
This commit is contained in:
@@ -17,7 +17,7 @@ class CookieTokenProvider implements ITokenProvider
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->token = $this->getToken();
|
||||
$this->token = ($this->hasToken() === true) ? $_COOKIE[static::CSRF_KEY] : null;
|
||||
|
||||
if ($this->token === null) {
|
||||
$this->token = $this->generateToken();
|
||||
@@ -73,8 +73,6 @@ class CookieTokenProvider implements ITokenProvider
|
||||
*/
|
||||
public function getToken(?string $defaultValue = null): ?string
|
||||
{
|
||||
$this->token = ($this->hasToken() === true) ? $_COOKIE[static::CSRF_KEY] : null;
|
||||
|
||||
return $this->token ?? $defaultValue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user