Permalink
Browse files

Denied access to new posts page when not logged in.

chapter7-3
  • Loading branch information...
tmeasday committed Apr 7, 2013
1 parent 3140d32 commit 10eac50e8636ad2bd5740b99198cf61ea8dc79f6
Showing with 15 additions and 0 deletions.
  1. +6 −0 client/templates/includes/access_denied.html
  2. +9 −0 lib/router.js
@@ -0,0 +1,6 @@
<template name="accessDenied">
<div class="access-denied page jumbotron">
<h2>Access Denied</h2>
<p>You can't get here! Please log in.</p>
</div>
</template>
View
@@ -14,4 +14,13 @@ Router.route('/posts/:_id', {
Router.route('/submit', {name: 'postSubmit'});
var requireLogin = function() {
if (! Meteor.user()) {
this.render('accessDenied');
} else {
this.next();
}
}
Router.onBeforeAction('dataNotFound', {only: 'postPage'});
Router.onBeforeAction(requireLogin, {only: 'postSubmit'});

0 comments on commit 10eac50

Please sign in to comment.