Check whether priorLoginDate is undefined

This commit is contained in:
Aysel Afsar 2016-04-11 09:43:22 -04:00
parent 1a48b6040a
commit 1891d1fe75
2 changed files with 7 additions and 1 deletions

View File

@ -367,6 +367,8 @@ ActiveEntry.resetPassword = function(passwordValue, confirmPassword) {
return; return;
} }
Session.set('_resetPasswordToken', null); Session.set('_resetPasswordToken', null);
// Update last login time
Meteor.call("updateLastLoginDate");
var ActiveEntryConfig = Session.get('Photonic.ActiveEntry'); var ActiveEntryConfig = Session.get('Photonic.ActiveEntry');
Router.go(ActiveEntryConfig.signIn.destination); Router.go(ActiveEntryConfig.signIn.destination);
}); });

View File

@ -127,8 +127,12 @@ Meteor.methods({
if (!user) { if (!user) {
return; return;
} }
var priorLoginDate = user.lastLoginDate;
if (!priorLoginDate) {
priorLoginDate = new Date();
}
// Update priorLoginDate and lastLoginDate // 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) { isAccountInactive: function (inactivityParameters) {