mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 21:01:33 +02:00
16 lines
419 B
CoffeeScript
16 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}"
|