From 4df225a8e4e52bee6d98b286565b94af7ab5cb82 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 20:51:26 +0100 Subject: [PATCH] Debug v17 --- htdocs/core/lib/functions.lib.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0093eda7d5e..6f85d0e6f3e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11276,6 +11276,22 @@ function currentToken() return isset($_SESSION['token']) ? $_SESSION['token'] : ''; } +/** + * Return a random string to be used as a nonce value for js + * + * @return string + */ +function getNonce() +{ + global $conf; + + if (empty($conf->cache['nonce'])) { + $conf->cache['nonce'] = dolGetRandomBytes(8); + } + + return $conf->cache['nonce']; +} + /** * Start a table with headers and a optinal clickable number (don't forget to use "finishSimpleTable()" after the last table row) *