allow <code class=...>, temporary MathJax fix, try to fix pre-filled inputs bug
[qomet.git] / utils / tokenGenerator.js
1 let TokenGen =
2 {
3 rand: function()
4 {
5 return Math.random().toString(36).substr(2); // remove `0.`
6 },
7
8 generate: function(tlen)
9 {
10 var res = "";
11 var nbRands = Math.ceil(tlen/10); //10 = min length of a rand() string
12 for (var i = 0; i < nbRands; i++)
13 res += TokenGen.rand();
14 return res.substr(0, tlen);
15 },
16 };
17
18 module.exports = TokenGen;