diff options
author | Dennis Eriksen <dennis.se@gmail.com> | 2013-04-29 11:24:04 +0200 |
---|---|---|
committer | Dennis Eriksen <dennis.se@gmail.com> | 2013-04-29 11:24:04 +0200 |
commit | 600f63bc7e3bd242afc79d6b631b05c95afe7c44 (patch) | |
tree | 47c862e111cffa4869f2e2789c9d66fe4cb74b05 /router.js | |
parent | added new project page (diff) | |
download | Divid-600f63bc7e3bd242afc79d6b631b05c95afe7c44.tar.gz |
added new project page and cleaned up a bit
Diffstat (limited to '')
-rw-r--r-- | router.js | 61 |
1 files changed, 15 insertions, 46 deletions
@@ -22,70 +22,39 @@ module.exports = function(app, passport, auth) { app.get('/faq', system.faq); - - app.get('/dashboard', system.dashboard); - - app.get('/login', users.login); + app.get('/signup', users.signup); - app.post('/login', users.signin); + app.post('/signup', users.create); - // GET /auth/facebook - // Use passport.authenticate() as route middleware to authenticate the - // request. The first step in Facebook authentication will involve - // redirecting the user to facebook.com. After authorization, Facebook will - // redirect the user back to this application at /auth/facebook/callback - app.get('/auth/facebook', passport.authenticate('facebook'), function(req, res){ - // The request will be redirected to Facebook for authentication, so this - // function will not be called. - }); + app.post('/test', users.signin); - // GET /auth/facebook/callback - // Use passport.authenticate() as route middleware to authenticate the - // request. If authentication fails, the user will be redirected back to the - // login page. Otherwise, the primary route function function will be called, - // which, in this example, will redirect the user to the home page. - app.get('/auth/facebook/callback', passport.authenticate('facebook', { failureRedirect: '/login' }), function(req, res) { + app.get('/auth/facebook', passport.authenticate('facebook', { failureRedirect: '/test' }), users.signin); + + app.get('/auth/facebook/callback', passport.authenticate('facebook', { failureRedirect: '/test' }), function(req, res) { console.log('/auth/facebook/callback --- ' + req.user.username); res.redirect('/dashboard'); }); - app.get('/auth/twitter', passport.authenticate('twitter', { failureRedirect: '/login' }), users.signin); - app.get('/auth/twitter/callback', passport.authenticate('twitter', { failureRedirect: '/login' }), users.authCallback); - - /* - * GET logout - * - * '/logout' - */ - app.get('/logout', users.logout); + app.get('/auth/twitter', passport.authenticate('twitter', { failureRedirect: '/test' }), users.signin); + app.get('/auth/twitter/callback', passport.authenticate('twitter', { failureRedirect: '/test' }), users.authCallback); + app.get('/logout', users.logout); - /* - * GET project page - * - * '/project' + /** + * REQUIRES LOGIN + * ============================================================ */ - app.get('/project', system.project); - - - - /* - * GET signup page - * - * '/signup' - */ - - app.get('/signup', users.signup); + app.get('/dashboard', system.dashboard); - /* POST */ - app.post('/signup', users.create); + app.get('/project', auth.requiresLogin, system.project); + app.get('/project/new', auth.requiresLogin, system.newproject); }; |