Skip to content

Commit

Permalink
cleared routes.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlbenitez committed Oct 4, 2015
1 parent 92a5380 commit 997737f
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand All @@ -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;
}


0 comments on commit 997737f

Please sign in to comment.