generate random password with uuid

This commit is contained in:
Henry Oswald 2014-04-07 11:14:50 +01:00
parent 1ce1a82617
commit 4ff8b48d85

View file

@ -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'