var requireLoginRt = function()
{
if (!!Meteor.user())
this.next(); // logged in
else if (Meteor.loggingIn())
this.render(this.loadingTemplate); // logging in (loading)
else
this.render('accessDenied'); // not logged in (access denied)
}
@dpatte you should check for Meteor.userId() rather than the full user object, because if you have code somewhere else that modifies the user, it will cause this function to re-run due to Meteor's reactivity
This only occurs on a system using polling instead of oplog, and only on pages that use onBeforeAction such as the following:
Router.onBeforeAction(requireLoginRt, {only: 'dealList'});
requireLoginRt looks like this:
var requireLoginRt = function() {
if (!!Meteor.user()) this.next(); // logged in else if (Meteor.loggingIn()) this.render(this.loadingTemplate); // logging in (loading) else this.render('accessDenied'); // not logged in (access denied) }