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('/control-shortcuts', resourcesController.controlShortcuts);
|
||||
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(
|
||||
'/pair-program-with-team-viewer',
|
||||
resourcesController.pairProgramWithTeamViewer
|
||||
);
|
||||
app.get('/learn-to-code', resourcesController.about);
|
||||
app.get('/about', resourcesController.about);
|
||||
app.get('/login', userController.getLogin);
|
||||
app.post('/login', userController.postLogin);
|
||||
app.get('/logout', userController.logout);
|
||||
app.get('/about', function(req, res) {
|
||||
res.redirect(301, '/learn-to-code');
|
||||
});
|
||||
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.post('/forgot', userController.postForgot);
|
||||
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-signin', userController.getEmailSignin);
|
||||
app.post('/email-signup', userController.postEmailSignup);
|
||||
app.post('/email-signin', userController.postLogin);
|
||||
app.post('/email-signin', userController.postSignin);
|
||||
app.get('/nonprofits', contactController.getNonprofitsForm);
|
||||
app.post('/nonprofits', contactController.postNonprofitsForm);
|
||||
|
||||
|
@ -40,9 +40,12 @@ exports.index = function(req, res) {
|
||||
};
|
||||
|
||||
exports.returnBonfire = function(req, res, next) {
|
||||
if (!req.user) {
|
||||
req.user = new User();
|
||||
}
|
||||
var bonfireNumber = parseInt(req.params.bonfireNumber) || 0;
|
||||
// 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) {
|
||||
return [index, value];
|
||||
});
|
||||
|
@ -142,7 +142,7 @@ module.exports = {
|
||||
debug('User err: ', err);
|
||||
next(err);
|
||||
}
|
||||
res.render('resources/about', {
|
||||
res.render('resources/learn-to-code', {
|
||||
title: 'About Free Code Camp and Our Team of Volunteers',
|
||||
daysRunning: daysRunning,
|
||||
nonprofitProjects: nonprofitProjects,
|
||||
|
@ -12,23 +12,23 @@ var _ = require('lodash'),
|
||||
//TODO(Berks): Refactor to use module.exports = {} pattern.
|
||||
|
||||
/**
|
||||
* GET /login
|
||||
* Login page.
|
||||
* GET /signin
|
||||
* Siginin page.
|
||||
*/
|
||||
|
||||
exports.getLogin = function(req, res) {
|
||||
exports.getSignin = function(req, res) {
|
||||
if (req.user) return res.redirect('/');
|
||||
res.render('account/login', {
|
||||
res.render('account/signin', {
|
||||
title: 'Free Code Camp Login'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* POST /login
|
||||
* POST /signin
|
||||
* 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('password', 'Password cannot be blank').notEmpty();
|
||||
|
||||
@ -36,14 +36,14 @@ exports.postLogin = function(req, res, next) {
|
||||
|
||||
if (errors) {
|
||||
req.flash('errors', errors);
|
||||
return res.redirect('/login');
|
||||
return res.redirect('/signin');
|
||||
}
|
||||
|
||||
passport.authenticate('local', function(err, user, info) {
|
||||
if (err) return next(err);
|
||||
if (!user) {
|
||||
req.flash('errors', { msg: info.message });
|
||||
return res.redirect('/login');
|
||||
return res.redirect('/signin');
|
||||
}
|
||||
req.logIn(user, function(err) {
|
||||
if (err) return next(err);
|
||||
@ -54,11 +54,11 @@ exports.postLogin = function(req, res, next) {
|
||||
};
|
||||
|
||||
/**
|
||||
* GET /logout
|
||||
* GET /signout
|
||||
* Log out.
|
||||
*/
|
||||
|
||||
exports.logout = function(req, res) {
|
||||
exports.signout = function(req, res) {
|
||||
req.logout();
|
||||
res.redirect('/');
|
||||
};
|
||||
@ -76,7 +76,7 @@ exports.getEmailSignin = function(req, res) {
|
||||
};
|
||||
|
||||
/**
|
||||
* GET /email-signin
|
||||
* GET /signin
|
||||
* Signup page.
|
||||
*/
|
||||
|
||||
@ -146,7 +146,7 @@ exports.getAccount = function(req, res) {
|
||||
console.error('Challenge err: ', err);
|
||||
next(err);
|
||||
}
|
||||
res.render('account/profile', {
|
||||
res.render('account/account', {
|
||||
title: 'Manage your Free Code Camp Account',
|
||||
challenges: c,
|
||||
ch: req.user.challengesHash,
|
||||
|
@ -1,14 +1,12 @@
|
||||
extends ../layout-wide
|
||||
block content
|
||||
include ../partials/navbar-wide
|
||||
.panel.panel-primary
|
||||
.panel-heading.landing-panel-heading.text-center Live Pair Programming
|
||||
.panel
|
||||
.panel-body
|
||||
.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 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
|
||||
a(href="http://twitch.tv/freecodecamp", target='_blank') Twitch.tv channel
|
||||
| .
|
||||
@ -24,11 +22,7 @@ block content
|
||||
.embed-responsive.embed-responsive-twitch-chat
|
||||
iframe(src='http://www.twitch.tv/freecodecamp/chat?popout=', frameborder='0', scrolling='no')
|
||||
|
||||
br
|
||||
.panel.panel-primary
|
||||
.panel-heading.landing-panel-heading.text-center Previous Live Pair Programming Sessions
|
||||
.panel-body
|
||||
.landing-panel-body.text-center
|
||||
h1 Previous Live Pair Programming Sessions
|
||||
.col-xs-12
|
||||
.embed-responsive.embed-responsive-16by9.big-break
|
||||
iframe.embed-responsive-item(src='//www.youtube.com/embed/_BErpDdmBOw')
|
||||
|
Reference in New Issue
Block a user