aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-05-15 13:36:41 +0200
committerDennis Eriksen <dennis.se@gmail.com>2013-05-15 13:36:41 +0200
commit294e9fa0e2821b0fe6376866ff783b038fccc593 (patch)
tree5ca54b9ee81e6d71fd574762cee90ad6b0c696b4
parentadded registerEmail so it works.. also, now it checks to see if email (diff)
downloadDivid-294e9fa0e2821b0fe6376866ff783b038fccc593.tar.gz
tweaked the random token generator
-rw-r--r--models/User.js4
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;