From 294e9fa0e2821b0fe6376866ff783b038fccc593 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Wed, 15 May 2013 13:36:41 +0200 Subject: tweaked the random token generator --- models/User.js | 4 ++-- 1 file 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; -- cgit v1.2.3