From 0908703b4b5251e76ac4866272457ede2d05c7b0 Mon Sep 17 00:00:00 2001 From: Adam Kunz Date: Tue, 8 May 2012 15:44:16 -0400 Subject: [PATCH] Password authentication will now add the whole user object to the session (sans salt and hash fields). This is instead of having a hard-coded .userId field and having only it and .loggedIn be returned. --- lib/modules/password.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/modules/password.js b/lib/modules/password.js index e64dc1ce..8e4b5edd 100644 --- a/lib/modules/password.js +++ b/lib/modules/password.js @@ -199,11 +199,14 @@ everyModule.submodule('password') }) .addToSession( function (sess, user, errors) { var _auth = sess.auth || (sess.auth = {}); - if (user) - _auth.userId = user[this._userPkey]; + if (user) { + for(key in user) { + if(key!='salt' && key!='hash') + _auth[key] = user[key]; + } + } _auth.loggedIn = !!user; - }) - .respondToLoginSucceed( function (res, user) { + }) .respondToLoginSucceed( function (res, user) { if (user) { this.redirect(res, this.loginSuccessRedirect()); }