Skip to content

Instantly share code, notes, and snippets.

@scottmackenzzz
Created August 14, 2013 07:03
Show Gist options
  • Save scottmackenzzz/6228640 to your computer and use it in GitHub Desktop.
Save scottmackenzzz/6228640 to your computer and use it in GitHub Desktop.
checkLoggedIn = (obj) ->
page = obj.page.defaultTemplate
if Meteor.loggingIn()
console.log 'Logging in'
if not Meteor.user() and page isnt 'login'
this.redirect('/login')
else
if Meteor.user() and page is 'login'
this.redirect('/')
Meteor.pages
"/":
to: "dashboard"
as: "root"
before: [checkLoggedIn]
"/login":
to: "login"
before: [checkLoggedIn]
"*": "404"
,
defaults:
layout: "layout"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment