Merge pull request #406 from QuincyLarson/auth
potentially fix the too many redirects issue
This commit is contained in:
@ -3,7 +3,13 @@
|
||||
* Home page.
|
||||
*/
|
||||
|
||||
exports.index = function(req, res) {
|
||||
exports.index = function(req, res, next) {
|
||||
if (req.user && !req.user.profile.picture) {
|
||||
req.user.profile.picture = 'https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png';
|
||||
req.user.save(function(err) {
|
||||
if (err) { return next(err); }
|
||||
});
|
||||
}
|
||||
res.render('home', {
|
||||
title: 'Learn to Code JavaScript and get a Coding Job by Helping Nonprofits'
|
||||
});
|
||||
|
@ -55,7 +55,7 @@ exports.postSignin = function(req, res, next) {
|
||||
return next(err);
|
||||
}
|
||||
req.flash('success', { msg: 'Success! You are logged in.' });
|
||||
res.redirect(req.session.returnTo || '/');
|
||||
return res.redirect(req.session.returnTo || '/');
|
||||
});
|
||||
})(req, res, next);
|
||||
};
|
||||
|
@ -41,17 +41,9 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height
|
||||
else
|
||||
a(href='/account') [ #{user.progressTimestamps.length} ]
|
||||
.hidden-xs.hidden-sm
|
||||
if user.profile.picture
|
||||
if (user.profile.username)
|
||||
a(href='/' + user.profile.username)
|
||||
img.profile-picture.float-right(src='#{user.profile.picture}')
|
||||
else
|
||||
a(href='/account')
|
||||
img.profile-picture.float-right(src='#{user.profile.picture}')
|
||||
if (user.profile.username)
|
||||
a(href='/' + user.profile.username)
|
||||
img.profile-picture.float-right(src='#{user.profile.picture}')
|
||||
else
|
||||
if (user.profile.username)
|
||||
a(href='/' + user.profile.username)
|
||||
img.profile-picture.float-right(src='#{user.gravatar(60)}')
|
||||
else
|
||||
a(href='/account')
|
||||
img.profile-picture.float-right(src='#{user.gravatar(60)}')
|
||||
a(href='/account')
|
||||
img.profile-picture.float-right(src='#{user.profile.picture}')
|
||||
|
Reference in New Issue
Block a user