fixed iron router
This commit is contained in:
parent
88731cc0fa
commit
38812e21f1
@ -3,7 +3,7 @@
|
||||
})
|
||||
|
||||
Router.route('/checkout', function() {
|
||||
if (Meteor.user()) {
|
||||
if (Meteor.user()._id != null) {
|
||||
this.render("checkout");
|
||||
} else {
|
||||
this.redirect('/login');
|
||||
@ -11,22 +11,20 @@ Router.route('/checkout', function() {
|
||||
});
|
||||
|
||||
Router.route('/login', function() {
|
||||
if (Roles.userIsInRole(Meteor.userId(), ['teacher'])) {
|
||||
this.redirect('/teacher');
|
||||
} else if (Roles.userIsInRole(Meteor.userId(), ['admin'])) {
|
||||
if (Roles.userIsInRole(Meteor.user()._id, ['admin'])) {
|
||||
this.redirect('/admin');
|
||||
} else {
|
||||
if (Meteor.loggingIn()) {
|
||||
Router.redirect('/login')
|
||||
}
|
||||
else {
|
||||
this.redirect('/checkout');
|
||||
};
|
||||
} else if (Roles.userIsInRole(Meteor.user()._id, ['teacher'])) {
|
||||
this.redirect('/teacher');
|
||||
} else if (Meteor.user()._id != null) {
|
||||
this.redirect('/checkout');
|
||||
}
|
||||
else {
|
||||
this.render('login')
|
||||
}
|
||||
});
|
||||
|
||||
Router.route('/admin', function() {
|
||||
if (Roles.userIsInRole(Meteor.userId(), ['admin'])) {
|
||||
if (Roles.userIsInRole(Meteor.user()._id, ['admin'])) {
|
||||
this.render("admin");
|
||||
} else {
|
||||
this.redirect('/login');
|
||||
@ -34,7 +32,7 @@ Router.route('/admin', function() {
|
||||
});
|
||||
|
||||
Router.route('/teacher', function() {
|
||||
if (Roles.userIsInRole(Meteor.userId(), ['admin', 'teacher'])) {
|
||||
if (Roles.userIsInRole(Meteor.user()._id, ['admin', 'teacher'])) {
|
||||
this.render("teacher");
|
||||
} else {
|
||||
this.redirect('/login');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user