I am using this method of redirecting users who are not logged in to another page:
Redirecting not logged-in users with iron-router... Again
The code:
EXCLUDED = ['signin', 'signup', 'forgotPassword', 'terms']
Router.onBeforeAction must_login, except: EXCLUDED
must_login = (pause) ->
if Meteor.user()
@setLayout @lookupLayoutTemplate() or 'blank'
else
if localStorage.getItem('has_logged_in_before') or Router.current().path is '/signin'
@setLayout 'signin'
else
@setLayout 'signup'
pause()
For the initial "/" page load, the signin
or signup
layout is correctly rendered, depending on the browser's localStorage. However, there is a link on the signup page: <a href="/signin">
. When it is clicked, the URL changes, but the page stays the same, and onBeforeAction is not rerun. What is the best way to get the page to change?