mirror of
https://github.com/getgrav/grav.git
synced 2026-05-06 11:26:25 +02:00
Handle multiple nonce action types per page
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user