Explorar o código

Made admin page require admin rank.

KrisVos130 %!s(int64=9) %!d(string=hai) anos
pai
achega
c3b548da52
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  1. 6 2
      app/app.js

+ 6 - 2
app/app.js

@@ -779,8 +779,12 @@ Router.route("/privacy", {
     template: "privacy"
 });
 
-Router.route("/admin", {
-    template: "admin"
+Router.route("/admin", function() {
+    if (Meteor.user() !== undefined && Meteor.user().profile !== undefined && Meteor.user().profile.rank === "admin") {
+        this.render("admin");
+    } else {
+        this.redirect("/");
+    }
 });
 
 Router.route("/:type", {