mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-11 22:10:53 +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")
|
UserDeleter = require("../Features/User/UserDeleter")
|
||||||
EmailHandler = require("../Features/Email/EmailHandler")
|
EmailHandler = require("../Features/Email/EmailHandler")
|
||||||
Url = require("url")
|
Url = require("url")
|
||||||
|
uuid = require("node-uuid")
|
||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
|
|
||||||
|
@ -101,7 +102,7 @@ module.exports =
|
||||||
logger.log email: email, "password reset requested"
|
logger.log email: email, "password reset requested"
|
||||||
User.findOne {'email':email}, (err, user)->
|
User.findOne {'email':email}, (err, user)->
|
||||||
if(user?)
|
if(user?)
|
||||||
randomPassword = generateRandomString 12
|
randomPassword = uuid.v4()
|
||||||
AuthenticationManager.setUserPassword user._id, randomPassword, (error) ->
|
AuthenticationManager.setUserPassword user._id, randomPassword, (error) ->
|
||||||
emailOpts =
|
emailOpts =
|
||||||
newPassword: randomPassword
|
newPassword: randomPassword
|
||||||
|
@ -224,15 +225,6 @@ module.exports =
|
||||||
res.send(200)
|
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 = []
|
THEME_LIST = []
|
||||||
do generateThemeList = () ->
|
do generateThemeList = () ->
|
||||||
files = fs.readdirSync __dirname + '/../../../public/js/ace/theme'
|
files = fs.readdirSync __dirname + '/../../../public/js/ace/theme'
|
||||||
|
|
Loading…
Reference in a new issue