Skip to content

Commit

Permalink
Check whether priorLoginDate is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
ayselafsar committed Apr 11, 2016
1 parent 1a48b60 commit 1891d1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Packages/active-entry/lib/ActiveEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ ActiveEntry.resetPassword = function(passwordValue, confirmPassword) {
return;
}
Session.set('_resetPasswordToken', null);
// Update last login time
Meteor.call("updateLastLoginDate");
var ActiveEntryConfig = Session.get('Photonic.ActiveEntry');
Router.go(ActiveEntryConfig.signIn.destination);
});
Expand Down
6 changes: 5 additions & 1 deletion Packages/active-entry/server/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,12 @@ Meteor.methods({
if (!user) {
return;
}
var priorLoginDate = user.lastLoginDate;
if (!priorLoginDate) {
priorLoginDate = new Date();
}
// Update priorLoginDate and lastLoginDate
Meteor.users.update({_id: Meteor.userId()}, {$set: {priorLoginDate: user.lastLoginDate, lastLoginDate: new Date()}});
Meteor.users.update({_id: Meteor.userId()}, {$set: {priorLoginDate: priorLoginDate, lastLoginDate: new Date()}});
},

isAccountInactive: function (inactivityParameters) {
Expand Down

0 comments on commit 1891d1f

Please sign in to comment.