full layout now works. refactor files and routes to have more conventional names and redirects where necessary
This commit is contained in:
22
app.js
22
app.js
@ -208,16 +208,26 @@ app.get('/deploy-a-website', resourcesController.deployAWebsite);
|
|||||||
app.get('/gmail-shortcuts', resourcesController.gmailShortcuts);
|
app.get('/gmail-shortcuts', resourcesController.gmailShortcuts);
|
||||||
app.get('/control-shortcuts', resourcesController.controlShortcuts);
|
app.get('/control-shortcuts', resourcesController.controlShortcuts);
|
||||||
app.get('/control-shortcuts', resourcesController.deployAWebsite);
|
app.get('/control-shortcuts', resourcesController.deployAWebsite);
|
||||||
app.get('/stats', resourcesController.stats);
|
app.get('/stats', function(req, res) {
|
||||||
|
res.redirect(301, '/learn-to-code');
|
||||||
|
});
|
||||||
app.get(
|
app.get(
|
||||||
'/pair-program-with-team-viewer',
|
'/pair-program-with-team-viewer',
|
||||||
resourcesController.pairProgramWithTeamViewer
|
resourcesController.pairProgramWithTeamViewer
|
||||||
);
|
);
|
||||||
app.get('/learn-to-code', resourcesController.about);
|
app.get('/learn-to-code', resourcesController.about);
|
||||||
app.get('/about', resourcesController.about);
|
app.get('/about', function(req, res) {
|
||||||
app.get('/login', userController.getLogin);
|
res.redirect(301, '/learn-to-code');
|
||||||
app.post('/login', userController.postLogin);
|
});
|
||||||
app.get('/logout', userController.logout);
|
app.get('/signin', userController.getSignin);
|
||||||
|
app.get('/login', function(req, res) {
|
||||||
|
res.redirect(301, '/signin');
|
||||||
|
});
|
||||||
|
app.post('/signin', userController.postSignin);
|
||||||
|
app.get('/signout', userController.signout);
|
||||||
|
app.get('/logout', function(req, res) {
|
||||||
|
res.redirect(301, '/signout');
|
||||||
|
});
|
||||||
app.get('/forgot', userController.getForgot);
|
app.get('/forgot', userController.getForgot);
|
||||||
app.post('/forgot', userController.postForgot);
|
app.post('/forgot', userController.postForgot);
|
||||||
app.get('/reset/:token', userController.getReset);
|
app.get('/reset/:token', userController.getReset);
|
||||||
@ -225,7 +235,7 @@ app.post('/reset/:token', userController.postReset);
|
|||||||
app.get('/email-signup', userController.getEmailSignup);
|
app.get('/email-signup', userController.getEmailSignup);
|
||||||
app.get('/email-signin', userController.getEmailSignin);
|
app.get('/email-signin', userController.getEmailSignin);
|
||||||
app.post('/email-signup', userController.postEmailSignup);
|
app.post('/email-signup', userController.postEmailSignup);
|
||||||
app.post('/email-signin', userController.postLogin);
|
app.post('/email-signin', userController.postSignin);
|
||||||
app.get('/nonprofits', contactController.getNonprofitsForm);
|
app.get('/nonprofits', contactController.getNonprofitsForm);
|
||||||
app.post('/nonprofits', contactController.postNonprofitsForm);
|
app.post('/nonprofits', contactController.postNonprofitsForm);
|
||||||
|
|
||||||
|
@ -40,9 +40,12 @@ exports.index = function(req, res) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.returnBonfire = function(req, res, next) {
|
exports.returnBonfire = function(req, res, next) {
|
||||||
|
if (!req.user) {
|
||||||
|
req.user = new User();
|
||||||
|
}
|
||||||
var bonfireNumber = parseInt(req.params.bonfireNumber) || 0;
|
var bonfireNumber = parseInt(req.params.bonfireNumber) || 0;
|
||||||
// This code is in bad need of refactoring
|
// This code is in bad need of refactoring
|
||||||
var bonfiresToFind = req.user.bonfiresHash;
|
var bonfiresToFind = req.user ? req.user.bonfiresHash : [];
|
||||||
var bonfiresArray = _.map(bonfiresToFind, function(value, index) {
|
var bonfiresArray = _.map(bonfiresToFind, function(value, index) {
|
||||||
return [index, value];
|
return [index, value];
|
||||||
});
|
});
|
||||||
|
@ -142,7 +142,7 @@ module.exports = {
|
|||||||
debug('User err: ', err);
|
debug('User err: ', err);
|
||||||
next(err);
|
next(err);
|
||||||
}
|
}
|
||||||
res.render('resources/about', {
|
res.render('resources/learn-to-code', {
|
||||||
title: 'About Free Code Camp and Our Team of Volunteers',
|
title: 'About Free Code Camp and Our Team of Volunteers',
|
||||||
daysRunning: daysRunning,
|
daysRunning: daysRunning,
|
||||||
nonprofitProjects: nonprofitProjects,
|
nonprofitProjects: nonprofitProjects,
|
||||||
|
@ -12,23 +12,23 @@ var _ = require('lodash'),
|
|||||||
//TODO(Berks): Refactor to use module.exports = {} pattern.
|
//TODO(Berks): Refactor to use module.exports = {} pattern.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GET /login
|
* GET /signin
|
||||||
* Login page.
|
* Siginin page.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.getLogin = function(req, res) {
|
exports.getSignin = function(req, res) {
|
||||||
if (req.user) return res.redirect('/');
|
if (req.user) return res.redirect('/');
|
||||||
res.render('account/login', {
|
res.render('account/signin', {
|
||||||
title: 'Free Code Camp Login'
|
title: 'Free Code Camp Login'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* POST /login
|
* POST /signin
|
||||||
* Sign in using email and password.
|
* Sign in using email and password.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.postLogin = function(req, res, next) {
|
exports.postSignin = function(req, res, next) {
|
||||||
req.assert('email', 'Email is not valid').isEmail();
|
req.assert('email', 'Email is not valid').isEmail();
|
||||||
req.assert('password', 'Password cannot be blank').notEmpty();
|
req.assert('password', 'Password cannot be blank').notEmpty();
|
||||||
|
|
||||||
@ -36,14 +36,14 @@ exports.postLogin = function(req, res, next) {
|
|||||||
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
req.flash('errors', errors);
|
req.flash('errors', errors);
|
||||||
return res.redirect('/login');
|
return res.redirect('/signin');
|
||||||
}
|
}
|
||||||
|
|
||||||
passport.authenticate('local', function(err, user, info) {
|
passport.authenticate('local', function(err, user, info) {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
req.flash('errors', { msg: info.message });
|
req.flash('errors', { msg: info.message });
|
||||||
return res.redirect('/login');
|
return res.redirect('/signin');
|
||||||
}
|
}
|
||||||
req.logIn(user, function(err) {
|
req.logIn(user, function(err) {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
@ -54,11 +54,11 @@ exports.postLogin = function(req, res, next) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GET /logout
|
* GET /signout
|
||||||
* Log out.
|
* Log out.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.logout = function(req, res) {
|
exports.signout = function(req, res) {
|
||||||
req.logout();
|
req.logout();
|
||||||
res.redirect('/');
|
res.redirect('/');
|
||||||
};
|
};
|
||||||
@ -76,7 +76,7 @@ exports.getEmailSignin = function(req, res) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GET /email-signin
|
* GET /signin
|
||||||
* Signup page.
|
* Signup page.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ exports.getAccount = function(req, res) {
|
|||||||
console.error('Challenge err: ', err);
|
console.error('Challenge err: ', err);
|
||||||
next(err);
|
next(err);
|
||||||
}
|
}
|
||||||
res.render('account/profile', {
|
res.render('account/account', {
|
||||||
title: 'Manage your Free Code Camp Account',
|
title: 'Manage your Free Code Camp Account',
|
||||||
challenges: c,
|
challenges: c,
|
||||||
ch: req.user.challengesHash,
|
ch: req.user.challengesHash,
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
extends ../layout-wide
|
extends ../layout-wide
|
||||||
block content
|
block content
|
||||||
include ../partials/navbar-wide
|
include ../partials/navbar-wide
|
||||||
.panel.panel-primary
|
.panel
|
||||||
.panel-heading.landing-panel-heading.text-center Live Pair Programming
|
|
||||||
.panel-body
|
.panel-body
|
||||||
.landing-panel-body.text-center
|
.landing-panel-body.text-center
|
||||||
|
h1 Live Pair Programming
|
||||||
h2 We live pair program every Tuesday from 9 pm to 10 pm EST (Eastern Standard Time).
|
h2 We live pair program every Tuesday from 9 pm to 10 pm EST (Eastern Standard Time).
|
||||||
h2 Our next session will be January 27th, 2015 at 9 p.m. EST!
|
h2 Our next session will be January 27th, 2015 at 9 p.m. EST!
|
||||||
h2 Join the discussion in our
|
|
||||||
a(href="chat.freecodecamp.com", target="_blank") FreeCodeCamp chat room.
|
|
||||||
h2 Watch the live stream below or on our
|
h2 Watch the live stream below or on our
|
||||||
a(href="http://twitch.tv/freecodecamp", target='_blank') Twitch.tv channel
|
a(href="http://twitch.tv/freecodecamp", target='_blank') Twitch.tv channel
|
||||||
| .
|
| .
|
||||||
@ -24,11 +22,7 @@ block content
|
|||||||
.embed-responsive.embed-responsive-twitch-chat
|
.embed-responsive.embed-responsive-twitch-chat
|
||||||
iframe(src='http://www.twitch.tv/freecodecamp/chat?popout=', frameborder='0', scrolling='no')
|
iframe(src='http://www.twitch.tv/freecodecamp/chat?popout=', frameborder='0', scrolling='no')
|
||||||
|
|
||||||
br
|
h1 Previous Live Pair Programming Sessions
|
||||||
.panel.panel-primary
|
|
||||||
.panel-heading.landing-panel-heading.text-center Previous Live Pair Programming Sessions
|
|
||||||
.panel-body
|
|
||||||
.landing-panel-body.text-center
|
|
||||||
.col-xs-12
|
.col-xs-12
|
||||||
.embed-responsive.embed-responsive-16by9.big-break
|
.embed-responsive.embed-responsive-16by9.big-break
|
||||||
iframe.embed-responsive-item(src='//www.youtube.com/embed/_BErpDdmBOw')
|
iframe.embed-responsive-item(src='//www.youtube.com/embed/_BErpDdmBOw')
|
||||||
|
Reference in New Issue
Block a user