From 583156d2f3fd54c073f17e5af771da7e2a0c55cf Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Tue, 24 Nov 2015 09:03:48 +0100 Subject: [PATCH] Handle multiple nonce action types per page --- system/src/Grav/Common/Utils.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system/src/Grav/Common/Utils.php b/system/src/Grav/Common/Utils.php index 71a706791..39528220d 100644 --- a/system/src/Grav/Common/Utils.php +++ b/system/src/Grav/Common/Utils.php @@ -15,7 +15,7 @@ abstract class Utils { use GravTrait; - protected static $nonce; + protected static $nonces = []; /** * @param string $haystack @@ -494,14 +494,14 @@ abstract class Utils public static function getNonce($action, $plusOneTick = false) { // Don't regenerate this again if not needed - if (isset(static::$nonce)) { - return static::$nonce; + if (isset(static::$nonces[$action])) { + return static::$nonces[$action]; } $nonce = self::hash(self::generateNonceString($action, $plusOneTick)); - static::$nonce = str_replace('/', 'SLASH', $nonce); + static::$nonces[$action] = str_replace('/', 'SLASH', $nonce); - return static::$nonce; + return static::$nonces[$action]; } /**