summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/util.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/util.php b/lib/util.php
index 08930e99a..51616799f 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -1477,3 +1477,11 @@ function common_canonical_sms($sms) {
preg_replace('/\D/', '', $sms);
return $sms;
}
+
+function common_session_token() {
+ common_ensure_session();
+ if (!array_key_exists('token', $_SESSION)) {
+ $_SESSION['token'] = common_random_bytes(64);
+ }
+ return $_SESSION['token'];
+}