From 4ff8b48d85fc424ffa45207a93757d5b193b488c Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 7 Apr 2014 11:14:50 +0100 Subject: [PATCH] generate random password with uuid --- .../web/app/coffee/controllers/UserController.coffee | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/services/web/app/coffee/controllers/UserController.coffee b/services/web/app/coffee/controllers/UserController.coffee index 63c0837009..2d4f4c206b 100644 --- a/services/web/app/coffee/controllers/UserController.coffee +++ b/services/web/app/coffee/controllers/UserController.coffee @@ -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'