summaryrefslogtreecommitdiff
path: root/static/main.js
diff options
context:
space:
mode:
authormarc <mlasch@mailbox.org>2019-08-15 14:36:55 +0200
committermarc <mlasch@mailbox.org>2019-08-15 14:36:55 +0200
commitd564b1e8f9e9155169d84b85d5ca6464515f1552 (patch)
treef6c5b7613ef1aa0c5432ddfd6aab0786fa5f11ab /static/main.js
parent5f60e7ba37e50964827e59f2a9079408bd0113b8 (diff)
downloadinfluxdb-guard-d564b1e8f9e9155169d84b85d5ca6464515f1552.tar.gz
influxdb-guard-d564b1e8f9e9155169d84b85d5ca6464515f1552.zip
Added config option for default token length
Diffstat (limited to 'static/main.js')
-rw-r--r--static/main.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/static/main.js b/static/main.js
index e00efd4..d03c1b9 100644
--- a/static/main.js
+++ b/static/main.js
@@ -1,10 +1,9 @@
-// Generate random token string
-
-const KEY_LENGTH = 20;
+// Generate random token string
+// TOKEN_LENGTH is provided by a inline script
const ALPHABET_BASE58 = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
function genToken() {
- const rand_buffer = Array.from(window.crypto.getRandomValues(new Uint32Array(KEY_LENGTH)));
+ const rand_buffer = Array.from(window.crypto.getRandomValues(new Uint32Array(TOKEN_LENGTH)));
const rand_chars = rand_buffer.map(elem => ALPHABET_BASE58.charAt(Math.round(elem/4294967295*58)));
const token = rand_chars.join("");