fix router not logged in stuff
This commit is contained in:
parent
38812e21f1
commit
961d1113c3
@ -3,7 +3,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
Router.route('/checkout', function() {
|
Router.route('/checkout', function() {
|
||||||
if (Meteor.user()._id != null) {
|
if (Meteor.user() != null) {
|
||||||
this.render("checkout");
|
this.render("checkout");
|
||||||
} else {
|
} else {
|
||||||
this.redirect('/login');
|
this.redirect('/login');
|
||||||
@ -11,15 +11,16 @@ Router.route('/checkout', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Router.route('/login', function() {
|
Router.route('/login', function() {
|
||||||
if (Roles.userIsInRole(Meteor.user()._id, ['admin'])) {
|
if (Meteor.user() == null) {
|
||||||
|
this.render("login");
|
||||||
|
} else if (Roles.userIsInRole(Meteor.user()._id, ['admin'])) {
|
||||||
this.redirect('/admin');
|
this.redirect('/admin');
|
||||||
} else if (Roles.userIsInRole(Meteor.user()._id, ['teacher'])) {
|
} else if (Roles.userIsInRole(Meteor.user()._id, ['teacher'])) {
|
||||||
this.redirect('/teacher');
|
this.redirect('/teacher');
|
||||||
} else if (Meteor.user()._id != null) {
|
} else if (Meteor.user() != null) {
|
||||||
this.redirect('/checkout');
|
this.redirect('/checkout');
|
||||||
}
|
} else {
|
||||||
else {
|
this.redirect('')
|
||||||
this.render('login')
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user