mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-11 16:14:40 +00:00
generate random password with uuid
This commit is contained in:
parent
1ce1a82617
commit
4ff8b48d85
1 changed files with 2 additions and 10 deletions
|
@ -16,6 +16,7 @@ SubscriptionLocator = require("../Features/Subscription/SubscriptionLocator")
|
|||
UserDeleter = require("../Features/User/UserDeleter")
|
||||
EmailHandler = require("../Features/Email/EmailHandler")
|
||||
Url = require("url")
|
||||
uuid = require("node-uuid")
|
||||
|
||||
module.exports =
|
||||
|
||||
|
@ -101,7 +102,7 @@ module.exports =
|
|||
logger.log email: email, "password reset requested"
|
||||
User.findOne {'email':email}, (err, user)->
|
||||
if(user?)
|
||||
randomPassword = generateRandomString 12
|
||||
randomPassword = uuid.v4()
|
||||
AuthenticationManager.setUserPassword user._id, randomPassword, (error) ->
|
||||
emailOpts =
|
||||
newPassword: randomPassword
|
||||
|
@ -224,15 +225,6 @@ module.exports =
|
|||
res.send(200)
|
||||
|
||||
|
||||
generateRandomString = (len)->
|
||||
chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"
|
||||
randomString = ''
|
||||
count = 0
|
||||
while count++ < len
|
||||
rnum = Math.floor(Math.random() * chars.length)
|
||||
randomString += chars.substring(rnum,rnum+1)
|
||||
return randomString
|
||||
|
||||
THEME_LIST = []
|
||||
do generateThemeList = () ->
|
||||
files = fs.readdirSync __dirname + '/../../../public/js/ace/theme'
|
||||
|
|
Loading…
Reference in a new issue