mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
15 lines
419 B
CoffeeScript
15 lines
419 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}"
|