diff options
author | Dennis Eriksen <dennis.se@gmail.com> | 2013-05-15 13:36:41 +0200 |
---|---|---|
committer | Dennis Eriksen <dennis.se@gmail.com> | 2013-05-15 13:36:41 +0200 |
commit | 294e9fa0e2821b0fe6376866ff783b038fccc593 (patch) | |
tree | 5ca54b9ee81e6d71fd574762cee90ad6b0c696b4 | |
parent | added registerEmail so it works.. also, now it checks to see if email (diff) | |
download | Divid-294e9fa0e2821b0fe6376866ff783b038fccc593.tar.gz |
tweaked the random token generator
-rw-r--r-- | models/User.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/models/User.js b/models/User.js index 37ad39f..c5f9df7 100644 --- a/models/User.js +++ b/models/User.js @@ -148,10 +148,10 @@ UserSchema.methods = { generateRandomToken: function(length) { if (typeof(length) === 'undefined') length = 16; // default length of token - var chars = "_!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" + var chars = '_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; , token = new Date().getTime() + '_'; for (var i = 0; i < length; i++) { - var x = Math.floor(Math.random() * 62); + var x = Math.floor(Math.random() * chars.length); token += chars.charAt(x); } return token; |