From c8db5200789dd1685cd85af904f9d0d3f7393c7e Mon Sep 17 00:00:00 2001 From: Haris Razis Date: Thu, 7 Jan 2021 10:56:52 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9E=95=20Add=20registered=20on=20user=20mode?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/models/User.js | 2 +- server/services/passport.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/models/User.js b/server/models/User.js index 788e720..5092e2a 100644 --- a/server/models/User.js +++ b/server/models/User.js @@ -5,7 +5,7 @@ const userSchema = new Schema({ username: String, email: String, password: String, - registered: String, + registered: Date, lastLogin: Date }); diff --git a/server/services/passport.js b/server/services/passport.js index e5b6fb2..9c3b1ed 100644 --- a/server/services/passport.js +++ b/server/services/passport.js @@ -25,7 +25,8 @@ passport.use('local', new LocalStrategy( .then(user => { if (!user) { const lastLogin = Date.now() - const newUser = new User({username, password, lastLogin}); + const registered = lastLogin + const newUser = new User({username, password, registered, lastLogin}); bcrypt.genSalt(10, (err, salt) => { bcrypt.hash(newUser.password, salt, (err, hash) => { if (err) throw err;