diff options
| author | HumairAK <humair88@hotmail.com> | 2016-07-24 00:46:35 +0000 |
|---|---|---|
| committer | HumairAK <humair88@hotmail.com> | 2016-07-24 00:46:35 +0000 |
| commit | 18b6e474fb64f7e9b4699d3bfbf3f5276e6996ad (patch) | |
| tree | df3a1f71250366ced02579f4f381ec74598861f3 /routes/admin.js | |
| parent | 17d743822746b047b94cd24e5407f1342ba01a7e (diff) | |
Finished questions, added servercallback for find_exam_byID
Diffstat (limited to 'routes/admin.js')
| -rw-r--r-- | routes/admin.js | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/routes/admin.js b/routes/admin.js index e038fa3..7e5c7fe 100644 --- a/routes/admin.js +++ b/routes/admin.js @@ -8,8 +8,6 @@ var passport_file = require('../config/passport.js'); var csrfProtection = csrf(); router.use(csrfProtection); // router is protected - - router.get('/', isAdmin, function(req,res){ res.render('admin', {csrfToken: req.csrfToken()}); }); @@ -65,7 +63,7 @@ router.post('/add/course', function(req,res){ res.redirect('/admin'); }); -// Add a new admin, redirect to admin panel +/* Add a new admin, redirect to admin panel */ router.post('/add/admin', function(req,res){ var admin_data = { fname: req.body.fname, @@ -128,9 +126,8 @@ module.exports = router; /************** Route protection ********************/ - function isAdmin(req, res, next) { - if (!req.user.email){ + if (req.user && !req.user.email){ return next(); } res.redirect('/'); |
