mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
16 lines
420 B
CoffeeScript
16 lines
420 B
CoffeeScript
module.exports = ProjectTokenGenerator =
|
|
|
|
|
|
readOnlyToken: () ->
|
|
length = 12
|
|
tokenAlpha = 'bcdfghjkmnpqrstvwxyz'
|
|
result = ''
|
|
for _n in [1..length]
|
|
i = Math.floor(Math.floor(Math.random() * tokenAlpha.length))
|
|
result += tokenAlpha[i]
|
|
return result
|
|
|
|
readAndWriteToken: () ->
|
|
numerics = Math.random().toString().slice(2, 12)
|
|
token = ProjectTokenGenerator.readOnlyToken()
|
|
return "#{numerics}#{token}"
|