flatten user object references throughout controllers and views
This commit is contained in:
@ -67,9 +67,9 @@ passport.use(new FacebookStrategy(secrets.facebook, function(req, accessToken, r
|
||||
if (err) { return done(err); }
|
||||
user.facebook = profile.id;
|
||||
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/camper-image-placeholder.png';
|
||||
user.name = user.name || profile.displayName;
|
||||
user.gender = user.gender || profile._json.gender;
|
||||
user.picture = user.picture || 'https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png';
|
||||
user.save(function(err) {
|
||||
if (err) { return done(err); }
|
||||
req.flash('info', { msg: 'Facebook account has been linked.' });
|
||||
@ -91,10 +91,10 @@ passport.use(new FacebookStrategy(secrets.facebook, function(req, accessToken, r
|
||||
user.email = profile._json.email;
|
||||
user.facebook = profile.id;
|
||||
user.tokens.push({ kind: 'facebook', accessToken: accessToken });
|
||||
user.profile.name = profile.displayName;
|
||||
user.profile.gender = profile._json.gender;
|
||||
user.profile.picture = 'https://graph.facebook.com/' + profile.id + '/picture?type=large';
|
||||
user.profile.location = (profile._json.location) ? profile._json.location.name : '';
|
||||
user.name = profile.displayName;
|
||||
user.gender = profile._json.gender;
|
||||
user.picture = 'https://graph.facebook.com/' + profile.id + '/picture?type=large';
|
||||
user.location = (profile._json.location) ? profile._json.location.name : '';
|
||||
user.save(function(err) {
|
||||
done(err, user);
|
||||
var transporter = nodemailer.createTransport({
|
||||
@ -140,10 +140,10 @@ passport.use(new GitHubStrategy(secrets.github, function(req, accessToken, refre
|
||||
User.findById(req.user.id, function(err, user) {
|
||||
user.github = profile.id;
|
||||
user.tokens.push({ kind: 'github', accessToken: accessToken });
|
||||
user.profile.name = user.profile.name || profile.displayName;
|
||||
user.profile.picture = user.profile.picture || profile._json.avatar_url;
|
||||
user.profile.location = user.profile.location || profile._json.location;
|
||||
user.profile.website = user.profile.website || profile._json.blog;
|
||||
user.name = user.name || profile.displayName;
|
||||
user.picture = user.picture || profile._json.avatar_url;
|
||||
user.location = user.location || profile._json.location;
|
||||
user.website = user.website || profile._json.blog;
|
||||
user.save(function(err) {
|
||||
if (err) { return done(err); }
|
||||
req.flash('info', { msg: 'GitHub account has been linked.' });
|
||||
@ -166,10 +166,10 @@ passport.use(new GitHubStrategy(secrets.github, function(req, accessToken, refre
|
||||
user.email = profile._json.email;
|
||||
user.github = profile.id;
|
||||
user.tokens.push({ kind: 'github', accessToken: accessToken });
|
||||
user.profile.name = profile.displayName;
|
||||
user.profile.picture = profile._json.avatar_url;
|
||||
user.profile.location = profile._json.location;
|
||||
user.profile.website = profile._json.blog;
|
||||
user.name = profile.displayName;
|
||||
user.picture = profile._json.avatar_url;
|
||||
user.location = profile._json.location;
|
||||
user.website = profile._json.blog;
|
||||
user.save(function(err) {
|
||||
if (err) { return done(err); }
|
||||
var transporter = nodemailer.createTransport({
|
||||
@ -216,11 +216,11 @@ passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tok
|
||||
User.findById(req.user.id, function(err, user) {
|
||||
user.twitter = profile.id;
|
||||
user.tokens.push({ kind: 'twitter', accessToken: accessToken, tokenSecret: tokenSecret });
|
||||
user.profile.username = user.profile.username || profile.username.toLowerCase();
|
||||
user.profile.name = user.profile.name || profile.displayName;
|
||||
user.profile.location = user.profile.location || profile._json.location;
|
||||
user.profile.picture = user.profile.picture || profile._json.profile_image_url_https.replace('_normal', '');
|
||||
user.profile.twitterHandle = user.profile.twitterHandle || profile.username.toLowerCase();
|
||||
user.username = user.username || profile.username.toLowerCase();
|
||||
user.name = user.name || profile.displayName;
|
||||
user.location = user.location || profile._json.location;
|
||||
user.picture = user.picture || profile._json.profile_image_url_https.replace('_normal', '');
|
||||
user.twitterHandle = user.twitterHandle || profile.username.toLowerCase();
|
||||
user.save(function(err) {
|
||||
if (err) { return done(err); }
|
||||
req.flash('info', { msg: 'Twitter account has been linked.' });
|
||||
@ -235,13 +235,13 @@ passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tok
|
||||
if (err) { return done(err); }
|
||||
if (existingUser) return done(null, existingUser);
|
||||
var user = new User();
|
||||
user.profile.username = profile.username.toLowerCase();
|
||||
user.username = profile.username.toLowerCase();
|
||||
user.twitter = profile.id;
|
||||
user.tokens.push({ kind: 'twitter', accessToken: accessToken, tokenSecret: tokenSecret });
|
||||
user.profile.name = profile.displayName;
|
||||
user.profile.location = profile._json.location;
|
||||
user.profile.picture = profile._json.profile_image_url_https.replace('_normal', '');
|
||||
user.profile.twitterHandle = user.profile.twitterHandle || profile.username.toLowerCase();
|
||||
user.name = profile.displayName;
|
||||
user.location = profile._json.location;
|
||||
user.picture = profile._json.profile_image_url_https.replace('_normal', '');
|
||||
user.twitterHandle = user.twitterHandle || profile.username.toLowerCase();
|
||||
user.save(function(err) {
|
||||
if (err) { return done(err); }
|
||||
done(null, user);
|
||||
@ -264,9 +264,9 @@ passport.use(new GoogleStrategy(secrets.google, function(req, accessToken, refre
|
||||
if (err) { return done(err); }
|
||||
user.google = profile.id;
|
||||
user.tokens.push({ kind: 'google', 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 || profile._json.picture;
|
||||
user.name = user.name || profile.displayName;
|
||||
user.gender = user.gender || profile._json.gender;
|
||||
user.picture = user.picture || profile._json.picture;
|
||||
user.save(function(err) {
|
||||
if (err) { return done(err); }
|
||||
req.flash('info', { msg: 'Google account has been linked.' });
|
||||
@ -289,9 +289,9 @@ passport.use(new GoogleStrategy(secrets.google, function(req, accessToken, refre
|
||||
user.email = profile._json.email;
|
||||
user.google = profile.id;
|
||||
user.tokens.push({ kind: 'google', accessToken: accessToken });
|
||||
user.profile.name = profile.displayName;
|
||||
user.profile.gender = profile._json.gender;
|
||||
user.profile.picture = profile._json.picture;
|
||||
user.name = profile.displayName;
|
||||
user.gender = profile._json.gender;
|
||||
user.picture = profile._json.picture;
|
||||
user.save(function(err) {
|
||||
if (err) { return done(err); }
|
||||
var transporter = nodemailer.createTransport({
|
||||
@ -339,10 +339,10 @@ passport.use(new LinkedInStrategy(secrets.linkedin, function(req, accessToken, r
|
||||
if (err) { return done(err); }
|
||||
user.linkedin = profile.id;
|
||||
user.tokens.push({ kind: 'linkedin', accessToken: accessToken });
|
||||
user.profile.name = user.profile.name || profile.displayName;
|
||||
user.profile.location = user.profile.location || profile._json.location.name;
|
||||
user.profile.picture = user.profile.picture || profile._json.pictureUrl;
|
||||
user.profile.website = user.profile.website || profile._json.publicProfileUrl;
|
||||
user.name = user.name || profile.displayName;
|
||||
user.location = user.location || profile._json.location.name;
|
||||
user.picture = user.picture || profile._json.pictureUrl;
|
||||
user.website = user.website || profile._json.publicProfileUrl;
|
||||
user.save(function(err) {
|
||||
if (err) { return done(err); }
|
||||
req.flash('info', { msg: 'LinkedIn account has been linked.' });
|
||||
@ -364,10 +364,10 @@ passport.use(new LinkedInStrategy(secrets.linkedin, function(req, accessToken, r
|
||||
user.linkedin = profile.id;
|
||||
user.tokens.push({ kind: 'linkedin', accessToken: accessToken });
|
||||
user.email = profile._json.emailAddress;
|
||||
user.profile.name = profile.displayName;
|
||||
user.profile.location = profile._json.location.name;
|
||||
user.profile.picture = profile._json.pictureUrl;
|
||||
user.profile.website = profile._json.publicProfileUrl;
|
||||
user.name = profile.displayName;
|
||||
user.location = profile._json.location.name;
|
||||
user.picture = profile._json.pictureUrl;
|
||||
user.website = profile._json.publicProfileUrl;
|
||||
user.save(function(err) {
|
||||
if (err) { return done(err); }
|
||||
var transporter = nodemailer.createTransport({
|
||||
|
@ -363,11 +363,11 @@ profileValidation.controller('profileValidationController', ['$scope', '$http',
|
||||
function($scope, $http) {
|
||||
$http.get('/account/api').success(function(data) {
|
||||
$scope.user = data.user;
|
||||
$scope.user.profile.username = $scope.user.profile.username ? $scope.user.profile.username.toLowerCase() : undefined;
|
||||
$scope.storedUsername = data.user.profile.username;
|
||||
$scope.user.username = $scope.user.username ? $scope.user.username.toLowerCase() : undefined;
|
||||
$scope.storedUsername = data.user.username;
|
||||
$scope.storedEmail = data.user.email;
|
||||
$scope.user.email = $scope.user.email ? $scope.user.email.toLowerCase() : undefined;
|
||||
$scope.user.profile.twitterHandle = $scope.user.profile.twitterHandle ? $scope.user.profile.twitterHandle.toLowerCase() : undefined;
|
||||
$scope.user.twitterHandle = $scope.user.twitterHandle ? $scope.user.twitterHandle.toLowerCase() : undefined;
|
||||
$scope.asyncComplete = true;
|
||||
});
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ module.exports = function(app) {
|
||||
app.use(router);
|
||||
|
||||
function index(req, res, next) {
|
||||
if (req.user && !req.user.profile.picture) {
|
||||
req.user.profile.picture =
|
||||
if (req.user && !req.user.picture) {
|
||||
req.user.picture =
|
||||
'https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png';
|
||||
|
||||
req.user.save(function(err) {
|
||||
|
@ -53,7 +53,7 @@ module.exports = function(app) {
|
||||
if (req.user.completedCoursewares.length > 63) {
|
||||
var hasShownInterest =
|
||||
nonprofit.interestedCampers.filter(function ( obj ) {
|
||||
return obj.username === req.user.profile.username;
|
||||
return obj.username === req.user.username;
|
||||
});
|
||||
|
||||
if (hasShownInterest.length === 0) {
|
||||
@ -110,8 +110,8 @@ module.exports = function(app) {
|
||||
function(err, nonprofit) {
|
||||
if (err) { return next(err); }
|
||||
nonprofit.interestedCampers.push({
|
||||
username: req.user.profile.username,
|
||||
picture: req.user.profile.picture,
|
||||
username: req.user.username,
|
||||
picture: req.user.picture,
|
||||
timeOfInterest: Date.now()
|
||||
});
|
||||
nonprofit.save(function(err) {
|
||||
|
@ -134,7 +134,7 @@ module.exports = function(app) {
|
||||
|
||||
|
||||
function getHelp(req, res) {
|
||||
var userName = req.user.profile.username;
|
||||
var userName = req.user.username;
|
||||
var code = req.body.payload.code ? '\n```\n' +
|
||||
req.body.payload.code + '\n```\n'
|
||||
: '';
|
||||
@ -154,7 +154,7 @@ module.exports = function(app) {
|
||||
}
|
||||
|
||||
function getPair(req, res) {
|
||||
var userName = req.user.profile.username;
|
||||
var userName = req.user.username;
|
||||
var challenge = req.body.payload.challenge;
|
||||
slack.send({
|
||||
text: [
|
||||
@ -201,7 +201,7 @@ module.exports = function(app) {
|
||||
} else {
|
||||
Rx.Observable.from(users)
|
||||
.map(function(user) {
|
||||
return user.profile.username;
|
||||
return user.username;
|
||||
})
|
||||
.toArray()
|
||||
.subscribe(
|
||||
|
@ -247,7 +247,7 @@ module.exports = function(app) {
|
||||
story.upVotes.push(
|
||||
{
|
||||
upVotedBy: req.user._id,
|
||||
upVotedByUsername: req.user.profile.username
|
||||
upVotedByUsername: req.user.username
|
||||
}
|
||||
);
|
||||
story.markModified('rank');
|
||||
@ -397,12 +397,12 @@ module.exports = function(app) {
|
||||
rank: 1,
|
||||
upVotes: [({
|
||||
upVotedBy: req.user._id,
|
||||
upVotedByUsername: req.user.profile.username
|
||||
upVotedByUsername: req.user.username
|
||||
})],
|
||||
author: {
|
||||
picture: req.user.profile.picture,
|
||||
picture: req.user.picture,
|
||||
userId: req.user._id,
|
||||
username: req.user.profile.username,
|
||||
username: req.user.username,
|
||||
email: req.user.email
|
||||
},
|
||||
comments: [],
|
||||
@ -452,9 +452,9 @@ module.exports = function(app) {
|
||||
rank: 0,
|
||||
upvotes: 0,
|
||||
author: {
|
||||
picture: req.user.profile.picture,
|
||||
picture: req.user.picture,
|
||||
userId: req.user._id,
|
||||
username: req.user.profile.username,
|
||||
username: req.user.username,
|
||||
email: req.user.email
|
||||
},
|
||||
comments: [],
|
||||
@ -494,9 +494,9 @@ module.exports = function(app) {
|
||||
originalStoryLink: data.originalStoryLink,
|
||||
originalStoryAuthorEmail: data.originalStoryAuthorEmail,
|
||||
author: {
|
||||
picture: req.user.profile.picture,
|
||||
picture: req.user.picture,
|
||||
userId: req.user._id,
|
||||
username: req.user.profile.username,
|
||||
username: req.user.username,
|
||||
email: req.user.email
|
||||
},
|
||||
comments: [],
|
||||
|
@ -406,27 +406,27 @@ module.exports = function(app) {
|
||||
});
|
||||
|
||||
res.render('account/show', {
|
||||
title: 'Camper ' + user.profile.username + '\'s portfolio',
|
||||
username: user.profile.username,
|
||||
name: user.profile.name,
|
||||
location: user.profile.location,
|
||||
githubProfile: user.profile.githubProfile,
|
||||
linkedinProfile: user.profile.linkedinProfile,
|
||||
codepenProfile: user.profile.codepenProfile,
|
||||
facebookProfile: user.profile.facebookProfile,
|
||||
twitterHandle: user.profile.twitterHandle,
|
||||
bio: user.profile.bio,
|
||||
picture: user.profile.picture,
|
||||
title: 'Camper ' + user.username + '\'s portfolio',
|
||||
username: user.username,
|
||||
name: user.name,
|
||||
location: user.location,
|
||||
githubProfile: user.githubProfile,
|
||||
linkedinProfile: user.linkedinProfile,
|
||||
codepenProfile: user.codepenProfile,
|
||||
facebookProfile: user.facebookProfile,
|
||||
twitterHandle: user.twitterHandle,
|
||||
bio: user.bio,
|
||||
picture: user.picture,
|
||||
progressTimestamps: user.progressTimestamps,
|
||||
website1Link: user.portfolio.website1Link,
|
||||
website1Title: user.portfolio.website1Title,
|
||||
website1Image: user.portfolio.website1Image,
|
||||
website2Link: user.portfolio.website2Link,
|
||||
website2Title: user.portfolio.website2Title,
|
||||
website2Image: user.portfolio.website2Image,
|
||||
website3Link: user.portfolio.website3Link,
|
||||
website3Title: user.portfolio.website3Title,
|
||||
website3Image: user.portfolio.website3Image,
|
||||
website1Link: user.website1Link,
|
||||
website1Title: user.website1Title,
|
||||
website1Image: user.website1Image,
|
||||
website2Link: user.website2Link,
|
||||
website2Title: user.website2Title,
|
||||
website2Image: user.website2Image,
|
||||
website3Link: user.website3Link,
|
||||
website3Title: user.website3Title,
|
||||
website3Image: user.website3Image,
|
||||
challenges: challenges,
|
||||
bonfires: user.completedChallenges.filter(function(challenge) {
|
||||
return challenge.challengeType === 5;
|
||||
@ -485,7 +485,7 @@ module.exports = function(app) {
|
||||
var user = req.user;
|
||||
if (
|
||||
existingUsername &&
|
||||
existingUsername.profile.username !== user.profile.username
|
||||
existingUsername.profile.username !== user.username
|
||||
) {
|
||||
req.flash('errors', {
|
||||
msg: 'An account with that username already exists.'
|
||||
@ -494,32 +494,32 @@ module.exports = function(app) {
|
||||
}
|
||||
var body = req.body || {};
|
||||
user.email = body.email.trim() || '';
|
||||
user.profile.name = body.name.trim() || '';
|
||||
user.profile.username = body.username.trim() || '';
|
||||
user.profile.location = body.location.trim() || '';
|
||||
user.name = body.name.trim() || '';
|
||||
user.username = body.username.trim() || '';
|
||||
user.location = body.location.trim() || '';
|
||||
|
||||
user.profile.githubProfile = body.githubProfile.trim() || '';
|
||||
user.profile.facebookProfile = body.facebookProfile.trim() || '';
|
||||
user.profile.linkedinProfile = body.linkedinProfile.trim() || '';
|
||||
user.githubProfile = body.githubProfile.trim() || '';
|
||||
user.facebookProfile = body.facebookProfile.trim() || '';
|
||||
user.linkedinProfile = body.linkedinProfile.trim() || '';
|
||||
|
||||
user.profile.codepenProfile = body.codepenProfile.trim() || '';
|
||||
user.profile.twitterHandle = body.twitterHandle.trim() || '';
|
||||
user.profile.bio = body.bio.trim() || '';
|
||||
user.codepenProfile = body.codepenProfile.trim() || '';
|
||||
user.twitterHandle = body.twitterHandle.trim() || '';
|
||||
user.bio = body.bio.trim() || '';
|
||||
|
||||
user.profile.picture = body.picture.trim() ||
|
||||
user.picture = body.picture.trim() ||
|
||||
'https://s3.amazonaws.com/freecodecamp/' +
|
||||
'camper-image-placeholder.png';
|
||||
user.portfolio.website1Title = body.website1Title.trim() || '';
|
||||
user.portfolio.website1Link = body.website1Link.trim() || '';
|
||||
user.portfolio.website1Image = body.website1Image.trim() || '';
|
||||
user.website1Title = body.website1Title.trim() || '';
|
||||
user.website1Link = body.website1Link.trim() || '';
|
||||
user.website1Image = body.website1Image.trim() || '';
|
||||
|
||||
user.portfolio.website2Title = body.website2Title.trim() || '';
|
||||
user.portfolio.website2Link = body.website2Link.trim() || '';
|
||||
user.portfolio.website2Image = body.website2Image.trim() || '';
|
||||
user.website2Title = body.website2Title.trim() || '';
|
||||
user.website2Link = body.website2Link.trim() || '';
|
||||
user.website2Image = body.website2Image.trim() || '';
|
||||
|
||||
user.portfolio.website3Title = body.website3Title.trim() || '';
|
||||
user.portfolio.website3Link = body.website3Link.trim() || '';
|
||||
user.portfolio.website3Image = body.website3Image.trim() || '';
|
||||
user.website3Title = body.website3Title.trim() || '';
|
||||
user.website3Link = body.website3Link.trim() || '';
|
||||
user.website3Image = body.website3Image.trim() || '';
|
||||
|
||||
|
||||
user.save(function (err) {
|
||||
@ -528,8 +528,8 @@ module.exports = function(app) {
|
||||
}
|
||||
updateUserStoryPictures(
|
||||
user._id.toString(),
|
||||
user.profile.picture,
|
||||
user.profile.username,
|
||||
user.picture,
|
||||
user.username,
|
||||
function(err) {
|
||||
if (err) { return next(err); }
|
||||
req.flash('success', {
|
||||
|
@ -15,7 +15,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='name') Name *
|
||||
.col-sm-4
|
||||
input.form-control(type='text', placeholder='Name', name='name', autocomplete="off", ng-model='user.profile.name', ng-minlength='3', ng-maxlength='50', required='required', id='name')
|
||||
input.form-control(type='text', placeholder='Name', name='name', autocomplete="off", ng-model='user.name', ng-minlength='3', ng-maxlength='50', required='required', id='name')
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.name.$invalid && profileForm.name.$error.required")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled(id='#name-error')
|
||||
@ -32,7 +32,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='username') Username (path to public profile) *
|
||||
.col-sm-4
|
||||
input.form-control(type='text', placeholder='username' name='username', autocomplete="off", id='username', ng-model='user.profile.username', required='required', ng-minlength='5', ng-maxlength='20', ng-keypress='', unique-username='', ng-pattern="/^[A-z0-9_]+$/")
|
||||
input.form-control(type='text', placeholder='username' name='username', autocomplete="off", id='username', ng-model='user.username', required='required', ng-minlength='5', ng-maxlength='20', ng-keypress='', unique-username='', ng-pattern="/^[A-z0-9_]+$/")
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.username.$error.pattern")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -49,7 +49,7 @@ block content
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
| Your username must be fewer than 15 characters.
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.username.$error.unique && !profileForm.username.$pristine && $scope.storedUsername !== user.profile.username")
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.username.$error.unique && !profileForm.username.$pristine && $scope.storedUsername !== user.username")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
| That username is already in use.
|
||||
@ -74,12 +74,12 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='location') Location
|
||||
.col-sm-4
|
||||
input.form-control(type='text', name='location', autocomplete="off", id='location', ng-model='user.profile.location')
|
||||
input.form-control(type='text', name='location', autocomplete="off", id='location', ng-model='user.location')
|
||||
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='email') Link to Profile Photo (1:1 ratio)
|
||||
.col-sm-4
|
||||
input.form-control(type='url', name='picture', id='picture', ng-model='user.profile.picture', placeholder='http://www.example.com/image.jpg')
|
||||
input.form-control(type='url', name='picture', id='picture', ng-model='user.picture', placeholder='http://www.example.com/image.jpg')
|
||||
.col-sm-4.col-sm-offset-5(ng-show="profileForm.picture.$error.url && !profileForm.picture.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -87,7 +87,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='bio') Bio (140 characters)
|
||||
.col-sm-4
|
||||
input.form-control(type='text', name='bio', autocomplete="off", ng-model='user.profile.bio', ng-maxlength='140', id='bio')
|
||||
input.form-control(type='text', name='bio', autocomplete="off", ng-model='user.bio', ng-maxlength='140', id='bio')
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show='profileForm.bio.$error.maxlength && !profileForm.bio.$pristine')
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -107,7 +107,7 @@ block content
|
||||
.col-sm-4
|
||||
.input-group.twitter-input
|
||||
span.input-group-addon @
|
||||
input.form-control(type='text', name='twitterHandle', autocomplete="off", id='twitterHandle', ng-model='user.profile.twitterHandle', ng-maxlength='15', ng-pattern="/^[A-z0-9_]+$/")
|
||||
input.form-control(type='text', name='twitterHandle', autocomplete="off", id='twitterHandle', ng-model='user.twitterHandle', ng-maxlength='15', ng-pattern="/^[A-z0-9_]+$/")
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.twitterHandle.$error.pattern")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -119,7 +119,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='email') GitHub
|
||||
.col-sm-4
|
||||
input.form-control(type='url', name='githubProfile', id='githubProfile', autocomplete="off", ng-model='user.profile.githubProfile', placeholder='http://')
|
||||
input.form-control(type='url', name='githubProfile', id='githubProfile', autocomplete="off", ng-model='user.githubProfile', placeholder='http://')
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.githubProfile.$error.url && !profileForm.githubProfile.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -128,7 +128,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='email') CodePen
|
||||
.col-sm-4
|
||||
input.form-control(type='url', name='codepenProfile', id='codepenProfile', autocomplete="off", ng-model='user.profile.codepenProfile', placeholder='http://')
|
||||
input.form-control(type='url', name='codepenProfile', id='codepenProfile', autocomplete="off", ng-model='user.codepenProfile', placeholder='http://')
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.codepenProfile.$error.url && !profileForm.codepenProfile.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -137,7 +137,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='email') LinkedIn
|
||||
.col-sm-4
|
||||
input.form-control(type='url', name='linkedinProfile', id='linkedinProfile', autocomplete="off", ng-model='user.profile.linkedinProfile', placeholder='http://')
|
||||
input.form-control(type='url', name='linkedinProfile', id='linkedinProfile', autocomplete="off", ng-model='user.linkedinProfile', placeholder='http://')
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.linkedinProfile.$error.url && !profileForm.linkedinProfile.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -146,7 +146,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='email') Facebook
|
||||
.col-sm-4
|
||||
input.form-control(type='url', name='facebookProfile', id='facebookProfile', autocomplete="off", ng-model='user.profile.facebookProfile', placeholder='http://')
|
||||
input.form-control(type='url', name='facebookProfile', id='facebookProfile', autocomplete="off", ng-model='user.facebookProfile', placeholder='http://')
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.facebookProfile.$error.url && !profileForm.facebookProfile.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -167,7 +167,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='website1Title') Title
|
||||
.col-sm-4
|
||||
input.form-control(type='text', name='website1Title', id='website1Title', autocomplete="off", ng-model='user.portfolio.website1Title', ng-maxlength='140')
|
||||
input.form-control(type='text', name='website1Title', id='website1Title', autocomplete="off", ng-model='user.website1Title', ng-maxlength='140')
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.website1Title.$error.maxlength && !profileForm.website1Title.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -176,7 +176,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='website1Link') Link
|
||||
.col-sm-4
|
||||
input.form-control(type='url', name='website1Link', id='website1Link', autocomplete="off", ng-model='user.portfolio.website1Link', placeholder='http://')
|
||||
input.form-control(type='url', name='website1Link', id='website1Link', autocomplete="off", ng-model='user.website1Link', placeholder='http://')
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.website1Link.$error.url && !profileForm.website1Link.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -185,7 +185,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='website1Image') Image Link (4:3 ratio)
|
||||
.col-sm-4
|
||||
input.form-control(type='url', name='website1Image', id='website1Image', autocomplete="off", ng-model='user.portfolio.website1Image', placeholder='http://www.example.com/image.jpg')
|
||||
input.form-control(type='url', name='website1Image', id='website1Image', autocomplete="off", ng-model='user.website1Image', placeholder='http://www.example.com/image.jpg')
|
||||
.col-sm-4.col-sm-offset-5(ng-show="profileForm.website1Image.$error.url && !profileForm.website1Image.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -197,7 +197,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='website2Title') Title
|
||||
.col-sm-4
|
||||
input.form-control(type='text', name='website2Title', id='website2Title', autocomplete="off", ng-model='user.portfolio.website2Title', ng-maxlength='140')
|
||||
input.form-control(type='text', name='website2Title', id='website2Title', autocomplete="off", ng-model='user.website2Title', ng-maxlength='140')
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.website2Title.$error.maxlength && !profileForm.website2Title.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -206,7 +206,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='website2Link') Link
|
||||
.col-sm-4
|
||||
input.form-control(type='url', name='website2Link', id='website2Link', autocomplete="off", ng-model='user.portfolio.website2Link', placeholder='http://')
|
||||
input.form-control(type='url', name='website2Link', id='website2Link', autocomplete="off", ng-model='user.website2Link', placeholder='http://')
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.website2Link.$error.url && !profileForm.website2Link.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -214,7 +214,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='website2Image') Image Link (4:3 ratio)
|
||||
.col-sm-4
|
||||
input.form-control(type='url', name='website2Image', id='website2Image', autocomplete="off", ng-model='user.portfolio.website2Image', placeholder='http://www.example.com/image.jpg')
|
||||
input.form-control(type='url', name='website2Image', id='website2Image', autocomplete="off", ng-model='user.website2Image', placeholder='http://www.example.com/image.jpg')
|
||||
.col-sm-4.col-sm-offset-5(ng-show="profileForm.website2Image.$error.url && !profileForm.website2Image.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -226,7 +226,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='website3Title') Title
|
||||
.col-sm-4
|
||||
input.form-control(type='text', name='website3Title', id='website3Title', autocomplete="off", ng-model='user.portfolio.website3Title', ng-maxlength='140')
|
||||
input.form-control(type='text', name='website3Title', id='website3Title', autocomplete="off", ng-model='user.website3Title', ng-maxlength='140')
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.website3Title.$error.maxlength && !profileForm.website3Title.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -235,7 +235,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='website3Link') Link
|
||||
.col-sm-4
|
||||
input.form-control(type='url', name='website3Link', id='website3Link', autocomplete="off", ng-model='user.portfolio.website3Link', placeholder='http://')
|
||||
input.form-control(type='url', name='website3Link', id='website3Link', autocomplete="off", ng-model='user.website3Link', placeholder='http://')
|
||||
.col-sm-4.col-sm-offset-5(ng-cloak, ng-show="profileForm.website3Link.$error.url && !profileForm.website3Link.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
@ -244,7 +244,7 @@ block content
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='website3Image') Image Link (4:3 ratio)
|
||||
.col-sm-4
|
||||
input.form-control(type='url', name='website3Image', id='website3Image', autocomplete="off", ng-model='user.portfolio.website3Image', placeholder='http://www.example.com/image.jpg', ng-pattern='/[\.](jpg|png|jpeg|gif)(\s+)?$/')
|
||||
input.form-control(type='url', name='website3Image', id='website3Image', autocomplete="off", ng-model='user.website3Image', placeholder='http://www.example.com/image.jpg', ng-pattern='/[\.](jpg|png|jpeg|gif)(\s+)?$/')
|
||||
.col-sm-4.col-sm-offset-5(ng-show="profileForm.website3Image.$error.url && !profileForm.website3Image.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
|
@ -7,7 +7,7 @@ block content
|
||||
.panel-heading.text-center
|
||||
h1 #{username}'s portfolio
|
||||
.panel-body
|
||||
if (user && user.profile.username === username)
|
||||
if (user && user.username === username)
|
||||
.row.text-center
|
||||
.col-xs-12.col-sm-10.col-sm-offset-1
|
||||
a.btn.btn-big.btn-primary.btn-block(href="/account") Update my portfolio page or manage my account
|
||||
|
@ -36,16 +36,16 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height
|
||||
a.btn.signup-btn.signup-btn-nav(href='/login') Sign in
|
||||
else
|
||||
li
|
||||
if (user.profile.username)
|
||||
if (user.username)
|
||||
|
||||
a(href='/' + user.profile.username) [ #{user.progressTimestamps.length} ]
|
||||
a(href='/' + user.username) [ #{user.progressTimestamps.length} ]
|
||||
|
||||
else
|
||||
a(href='/account') [ #{user.progressTimestamps.length} ]
|
||||
.hidden-xs.hidden-sm
|
||||
if (user.profile.username)
|
||||
a(href='/' + user.profile.username)
|
||||
img.profile-picture.float-right(src='#{user.profile.picture}')
|
||||
if (user.username)
|
||||
a(href='/' + user.username)
|
||||
img.profile-picture.float-right(src='#{user.picture}')
|
||||
else
|
||||
a(href='/account')
|
||||
img.profile-picture.float-right(src='#{user.profile.picture}')
|
||||
img.profile-picture.float-right(src='#{user.picture}')
|
||||
|
@ -4,7 +4,7 @@ block content
|
||||
script.
|
||||
var isLoggedIn = true;
|
||||
var B3BA669EC5C1DD70FB478221E067A7E1B686929C569F5E73561B69C8F42129B = !{JSON.stringify(user._id)};
|
||||
var DF105CFA89562196E702912B3818C6A5B46E80D262442FDF29976621E5AF0D23 = !{JSON.stringify(user.profile.username)};
|
||||
var DF105CFA89562196E702912B3818C6A5B46E80D262442FDF29976621E5AF0D23 = !{JSON.stringify(user.username)};
|
||||
else
|
||||
script.
|
||||
var isLoggedIn = false;
|
||||
|
Reference in New Issue
Block a user