diff options
| author | kumar <kumar.damani@mail.utoronto.ca> | 2016-07-24 00:56:03 +0000 |
|---|---|---|
| committer | kumar <kumar.damani@mail.utoronto.ca> | 2016-07-24 00:56:03 +0000 |
| commit | fe51deb31bbcc90530617b2b8aa60caf17c76729 (patch) | |
| tree | 9027f2575490112dfb8bdf363e2bd02046cebd64 /routes/admin.js | |
| parent | f94e655f733e3be2a5fa2b009e9899c1b8886f03 (diff) | |
| parent | 18b6e474fb64f7e9b4699d3bfbf3f5276e6996ad (diff) | |
a pull
Merge branch 'master' of https://github.com/HumairAK/solutions_repo
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('/'); |
