Added NotFound for undefined user, and moved redirection to router
This commit is contained in:
parent
725a72f21a
commit
b480fa6558
@ -1079,8 +1079,8 @@ input, textarea {
|
|||||||
#markDone p, #markConfirm p, #markReport p {
|
#markDone p, #markConfirm p, #markReport p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
#markDone, #markConfirm, #markReport {
|
#markDone, #markConfirm, #markReport {
|
||||||
padding: 5%;
|
padding: 5%;
|
||||||
background-color: rgba(0,0,0,0.1);
|
background-color: rgba(0,0,0,0.1);
|
||||||
@ -1160,7 +1160,7 @@ input, textarea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#userDropdownAvatar p {
|
#userDropdownAvatar p {
|
||||||
width: 9vh;
|
width: 15vw;
|
||||||
margin: 0 auto 0 auto;
|
margin: 0 auto 0 auto;
|
||||||
padding-top: 12vh;
|
padding-top: 12vh;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@ -47,7 +47,6 @@ Router.route('/profile', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Router.route('/user/:email', {
|
Router.route('/user/:email', {
|
||||||
template: 'user',
|
|
||||||
data: function() {
|
data: function() {
|
||||||
return Meteor.users.findOne({'services.google.email': this.params.email});
|
return Meteor.users.findOne({'services.google.email': this.params.email});
|
||||||
},
|
},
|
||||||
@ -55,9 +54,31 @@ Router.route('/user/:email', {
|
|||||||
return [
|
return [
|
||||||
Meteor.subscribe('users', this.params._id)
|
Meteor.subscribe('users', this.params._id)
|
||||||
];
|
];
|
||||||
|
},
|
||||||
|
action: function() {
|
||||||
|
if(Meteor.users.findOne({'services.google.email': this.params.email}) !== undefined) {
|
||||||
|
if(this.params.email === Meteor.user().services.google.email) {
|
||||||
|
this.redirect('/profile');
|
||||||
|
} else {
|
||||||
|
this.render('user');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.render("NotFound");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*Router.route('/admin', {
|
||||||
|
action: function() {
|
||||||
|
console.log("hi");
|
||||||
|
if (!Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) {
|
||||||
|
this.redirect("/");
|
||||||
|
} else {
|
||||||
|
this.render("admin");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
|
||||||
Router.configure({
|
Router.configure({
|
||||||
notFoundTemplate: "NotFound"
|
notFoundTemplate: "NotFound"
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user