summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-09-16 16:30:22 -0400
committerJules Laplace <jules@okfoc.us>2014-09-16 16:30:22 -0400
commita140d347c7e4e1a6c17ab117832056e3d7f7e512 (patch)
tree73b92918fc13ac909f4686af0ba702fcaae0fe4e /server
parent00a14b6411c480ba4f5f086cea90f50f930c23f1 (diff)
/staff/authorize to get staff access
Diffstat (limited to 'server')
-rw-r--r--server/index.js2
-rw-r--r--server/lib/views/staff.js15
2 files changed, 15 insertions, 2 deletions
diff --git a/server/index.js b/server/index.js
index e80ddf2..7112bde 100644
--- a/server/index.js
+++ b/server/index.js
@@ -61,7 +61,7 @@ site.setup = function(){
app.use(passport.initialize());
app.use(passport.session());
app.use(app.router);
- app.enable('trust proxy')
+ app.set('trust proxy', true)
app.get('env') === 'development' && app.use(express.errorHandler());
// Essential middleware
diff --git a/server/lib/views/staff.js b/server/lib/views/staff.js
index 70ca414..ffacee2 100644
--- a/server/lib/views/staff.js
+++ b/server/lib/views/staff.js
@@ -356,7 +356,14 @@ var staff = module.exports = {
staff.users.bless
);
-
+
+ if (app.get('env') === 'development') {
+ app.get('/staff/authorize',
+ middleware.ensureAuthenticated,
+ staff.users.blessSelf
+ );
+ }
+
//
// projects
@@ -463,6 +470,12 @@ var staff = module.exports = {
res.render('staff/users/show_404')
}
},
+ blessSelf: function(req, res){
+ req.user.isStaff = true
+ req.user.save(function(err, user){
+ res.json({ state: user.isStaff })
+ })
+ },
bless: function(req, res){
res.locals.profile.isStaff = req.body.state == "true"
res.locals.profile.save(function(err, user){