Skip to content

Commit

Permalink
add @Rybar's new placeholder camper image and fix the broken logic th…
Browse files Browse the repository at this point in the history
…at was supposed to update it for existing users
  • Loading branch information
Michael Q Larson committed Mar 12, 2015
1 parent 3004c64 commit 8e8711d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion config/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ passport.use(new FacebookStrategy(secrets.facebook, function(req, accessToken, r
user.tokens.push({ kind: 'facebook', accessToken: accessToken });
user.profile.name = user.profile.name || profile.displayName;
user.profile.gender = user.profile.gender || profile._json.gender;
user.profile.picture = user.profile.picture || 'https://s3.amazonaws.com/freecodecamp/favicons/apple-touch-icon-180x180.png';
user.profile.picture = user.profile.picture || 'https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png';
user.save(function(err) {
req.flash('info', { msg: 'Facebook account has been linked.' });
done(err, user);
Expand Down
7 changes: 2 additions & 5 deletions controllers/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,11 @@ module.exports = {

about: function(req, res) {
if (req.user) {
if (!req.user.picture) {

req.user.picture = "https://s3.amazonaws.com/freecodecamp/favicons/apple-touch-icon-180x180.png";
if (!req.user.profile.picture || req.user.profile.picture === "https://s3.amazonaws.com/freecodecamp/favicons/apple-touch-icon-180x180.png") {
req.user.profile.picture = "https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png";
req.user.save();
}
}


var date1 = new Date("10/15/2014");
var date2 = new Date();
var timeDiff = Math.abs(date2.getTime() - date1.getTime());
Expand Down
4 changes: 2 additions & 2 deletions controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ exports.postEmailSignup = function(req, res, next) {
password: req.body.password,
profile : {
username: req.body.username.trim(),
picture: 'https://s3.amazonaws.com/freecodecamp/favicons/apple-touch-icon-180x180.png'
picture: 'https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png'
}
});

Expand Down Expand Up @@ -362,7 +362,7 @@ exports.postUpdateProfile = function(req, res, next) {
user.profile.codepenProfile = req.body.codepenProfile.trim() || '';
user.profile.twitterHandle = req.body.twitterHandle.trim() || '';
user.profile.bio = req.body.bio.trim() || '';
user.profile.picture = req.body.picture.trim() || 'https://s3.amazonaws.com/freecodecamp/favicons/apple-touch-icon-180x180.png';
user.profile.picture = req.body.picture.trim() || 'https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png';
user.portfolio.website1Title = req.body.website1Title.trim() || '';
user.portfolio.website1Link = req.body.website1Link.trim() || '';
user.portfolio.website1Image = req.body.website1Image.trim() || '';
Expand Down
2 changes: 1 addition & 1 deletion views/account/show.jade
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ block content
if picture
img.img-center.img-responsive.public-profile-img(src=picture)
else
img.img-center.img-responsive.public-profile-img(src='https://s3.amazonaws.com/freecodecamp/favicons/apple-touch-icon-180x180.png')
img.img-center.img-responsive.public-profile-img(src='https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png')
h1.text-center.negative-5
- if (twitterHandle)
a.ion-social-twitter.text-primary(title="@#{username}'s Twitter Profile", href="http://twitter.com/#{twitterHandle}", target='_blank')
Expand Down

0 comments on commit 8e8711d

Please sign in to comment.