cleaned up and fixed redirect code
This commit is contained in:
parent
d2b12ae8c1
commit
4260d448bf
@ -55,7 +55,7 @@ oauth@1.1.3
|
||||
oauth2@1.1.2
|
||||
observe-sequence@1.0.4
|
||||
ordered-dict@1.0.2
|
||||
percolate:momentum@0.7.1
|
||||
percolate:momentum@0.7.0
|
||||
percolate:velocityjs@1.1.0
|
||||
random@1.0.2
|
||||
reactive-dict@1.0.5
|
||||
|
||||
@ -15,15 +15,6 @@ Template.initial.events({
|
||||
window.open(links[randomint], "_blank");
|
||||
},
|
||||
'click .submit': function() {
|
||||
Router.go('/checkout');
|
||||
}
|
||||
})
|
||||
Template.login.events({
|
||||
'click .chromeicon': function() {
|
||||
var randomint = Math.floor(Math.random() * (links.length - 1));
|
||||
window.open(links[randomint], "_blank");
|
||||
},
|
||||
'click .submit': function() {
|
||||
Router.go('/checkout');
|
||||
Router.go('/login');
|
||||
}
|
||||
})
|
||||
9
chromebook-checkout-meteor/client/login.js
Normal file
9
chromebook-checkout-meteor/client/login.js
Normal file
@ -0,0 +1,9 @@
|
||||
Template.login.events({
|
||||
'click .chromeicon': function() {
|
||||
var randomint = Math.floor(Math.random() * (links.length - 1));
|
||||
window.open(links[randomint], "_blank");
|
||||
},
|
||||
'click .submit': function() {
|
||||
Router.go('/login');
|
||||
}
|
||||
})
|
||||
@ -1,4 +1,4 @@
|
||||
Router.route('/', function() {
|
||||
Router.route('/', function() {
|
||||
this.render("initial");
|
||||
})
|
||||
|
||||
@ -15,12 +15,13 @@ Router.route('/login', function() {
|
||||
this.redirect('/teacher');
|
||||
} else if (Roles.userIsInRole(Meteor.userId(), ['admin'])) {
|
||||
this.redirect('/admin');
|
||||
} else if (Roles.userIsInRole(Meteor.userId(), ['admin', 'teacher'])) {
|
||||
this.redirect('/admin');
|
||||
} else if (Meteor.user()) {
|
||||
this.redirect('/checkout');
|
||||
} else {
|
||||
this.render("login");
|
||||
if (Meteor.loggingIn()) {
|
||||
Router.redirect('/login')
|
||||
}
|
||||
else {
|
||||
this.redirect('/checkout');
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
@ -36,6 +37,6 @@ Router.route('/teacher', function() {
|
||||
if (Roles.userIsInRole(Meteor.userId(), ['admin', 'teacher'])) {
|
||||
this.render("teacher");
|
||||
} else {
|
||||
this.redirect('/login');
|
||||
this.redirect('/login');
|
||||
}
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user