diff options
| author | nanalelfe <nargiza.nosirova@mail.utoronto.ca> | 2016-07-27 08:59:40 +0000 |
|---|---|---|
| committer | nanalelfe <nargiza.nosirova@mail.utoronto.ca> | 2016-07-27 08:59:40 +0000 |
| commit | b0cbe2db0ee3311fc028e7229749726d4cfe6973 (patch) | |
| tree | 76f04328c7f4026f80b20fe25a1f01a78ddf7c26 /routes/index.js | |
| parent | ef5d0e0304cea09fdd67745153e617b197667479 (diff) | |
Added third party verification.
Diffstat (limited to 'routes/index.js')
| -rw-r--r-- | routes/index.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/routes/index.js b/routes/index.js index b3336dc..ed79f12 100644 --- a/routes/index.js +++ b/routes/index.js @@ -7,6 +7,7 @@ router.use(csrfProtection); // router is protected // Remove later var passport_file = require('../config/passport.js'); var bcrypt = require('bcrypt-nodejs'); +var passport = require('passport'); /* Render/GET homepage. */ router.get('/', function(req, res, next) { @@ -250,15 +251,16 @@ router.get('/solutions/:exam_id/:q_num', function (req, res) { // Redirect the user to Facebook for authentication. When complete, // Facebook will redirect the user back to the application at // /auth/facebook/callback -app.get('/auth/facebook', passport.authenticate('facebook')); +router.get('/auth/facebook', passport.authenticate('facebook')); // Facebook will redirect the user to this URL after approval. Finish the // authentication process by attempting to obtain an access token. If // access was granted, the user will be logged in. Otherwise, // authentication has failed. -app.get('/auth/facebook/callback', - passport.authenticate('facebook', { successRedirect: '/user/user_profile', - failureRedirect: '/signin' })); +router.get('/auth/facebook/callback', + passport.authenticate('facebook', { + successRedirect: '/user/user_profile', + failureRedirect: '/user/logout' })); |
