From 997737f1a3db351f9f146b350890570767df81dc Mon Sep 17 00:00:00 2001 From: Javi Benitez Date: Sun, 4 Oct 2015 02:02:27 -0700 Subject: [PATCH] cleared routes.js --- config/routes.js | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/config/routes.js b/config/routes.js index f1f835b..457b783 100644 --- a/config/routes.js +++ b/config/routes.js @@ -2,13 +2,7 @@ var kids = require('./../server/controllers/kids.js') var express = require('express'); var router = express.Router(); -var passport = require('passport'); -var isAuthenticated = function (req, res, next) { - if (req.isAuthenticated()) - return.next(); - res.redirect('/'); -} module.exports = function(app){ app.post('/add_kid',function(req,res){ @@ -21,45 +15,4 @@ module.exports = function(app){ }); } -module.exports = function(passport){ - - /* GET login page. */ - router.get('/', function(req, res) { - // Display the Login page with any flash message, if any - res.render('index', { message: req.flash('message') }); - }); - - /* Handle Login POST */ - router.post('/login', passport.authenticate('login', { - successRedirect: '/home', - failureRedirect: '/', - failureFlash : true - })); - - /* GET Registration Page */ - router.get('/signup', function(req, res){ - res.render('register',{message: req.flash('message')}); - }); - - /* Handle Registration POST */ - router.post('/signup', passport.authenticate('signup', { - successRedirect: '/home', - failureRedirect: '/signup', - failureFlash : true - })); - - /* GET Home Page */ - router.get('/home', isAuthenticated, function(req, res){ - res.render('home', { user: req.user }); - }); - - /* Handle Logout */ - router.get('/signout', function(req, res) { - req.logout(); - res.redirect('/'); - }); - - return router; -} -