mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 03:43:41 +00:00
More sensible conversion of byte-buffer to array
This commit is contained in:
parent
ec94e59388
commit
83bd78f467
1 changed files with 3 additions and 4 deletions
|
@ -15,10 +15,9 @@ module.exports = ProjectTokenGenerator =
|
|||
TOKEN_NUMERICS: '123456789'
|
||||
|
||||
_randomString: (length, alphabet) ->
|
||||
result = ''
|
||||
crypto.randomBytes(length).map(
|
||||
(b) -> result += alphabet[b % alphabet.length]
|
||||
)
|
||||
result = crypto.randomBytes(length).toJSON().data.map(
|
||||
(b) -> alphabet[b % alphabet.length]
|
||||
).join('')
|
||||
return result
|
||||
|
||||
# Generate a 12-char token with only characters from TOKEN_ALPHA,
|
||||
|
|
Loading…
Reference in a new issue