finished with profile page for now

This commit is contained in:
Michael Q Larson
2014-12-24 00:07:20 -08:00
parent 6906de7146
commit d39804053c
6 changed files with 18 additions and 13 deletions

View File

@ -89,6 +89,7 @@ passport.use(
tokenSecret: tokenSecret
});
user.profile.name = user.profile.name || profile.displayName;
user.profile.username = user.profile.username || profile.username;
user.profile.location =
user.profile.location || profile._json.location;
@ -117,6 +118,7 @@ passport.use(
tokenSecret: tokenSecret
});
user.profile.name = user.profile.name || profile.displayName;
user.profile.username = user.profile.username || profile.username;
user.profile.location =
user.profile.location || profile._json.location;

View File

@ -181,8 +181,8 @@ exports.postUpdateProfile = function(req, res, next) {
req.assert('email', 'Email is required').notEmpty();
req.assert('email', 'Please enter a valid email address.').isEmail();
req.assert('username', 'Your username must be between 3 and 20 characters').len(3, 20);
req.assert('username', 'Your username can only use letters, numbers or underscores').matchRegex(/[A-Za-z0-9_]+/);
req.assert('username', 'Your username cannot be longer than 20 characters').len(1, 20);
req.assert('username', 'Your username can only use letters, numbers or underscores').matchRegex(/^[A-z0-9_]+$/);
var errors = req.validationErrors();
if (errors) {
req.flash('errors', errors);
@ -208,8 +208,6 @@ exports.postUpdateProfile = function(req, res, next) {
if (existingUsername && existingUsername.profile.username != user.profile.username) {
console.log(user.profile.username)
console.log(existingUsername.username)
console.log(existingUsername.profile.username)
console.log(user.profile.username)
req.flash('errors', {
msg: 'An account with that username already exists.'
});

View File

@ -261,6 +261,7 @@ ul {
.btn-link-social {
max-width: 400px;
margin: auto;
margin-bottom: 10px;
}

View File

@ -2,29 +2,29 @@ extends ../layout
block content
.panel
.container
.container.text-center
h1 Update your profile here:
.animated.flipInX
form.form-horizontal(action='/account/profile', method='POST')
input(type='hidden', name='_csrf', value=_csrf)
.form-group
label.col-sm-2.control-label(for='name') Name
label.col-sm-3.col-sm-offset-2.control-label(for='name') Name
.col-sm-4
input.form-control(type='text', name='name', id='name', value='#{user.profile.name}')
.form-group
label.col-sm-2.control-label(for='username') Username (no spaces)
label.col-sm-3.col-sm-offset-2.control-label(for='username') Username (use letters, numbers, underscore) *
.col-sm-4
input.form-control(type='text', name='username', id='username', value='#{user.profile.username}')
.form-group
label.col-sm-2.control-label(for='email') Email
label.col-sm-3.col-sm-offset-2.control-label(for='email') Email *
.col-sm-4
input.form-control(type='email', name='email', id='email', value='#{user.email}')
.form-group
label.col-sm-2.control-label(for='location') Location
label.col-sm-3.col-sm-offset-2.control-label(for='location') Location
.col-sm-4
input.form-control(type='text', name='location', id='location', value='#{user.profile.location}')
.form-group
label.col-sm-2.control-label(for='website') Website
label.col-sm-3.col-sm-offset-2.control-label(for='website') Website
.col-sm-4
input.form-control(type='text', name='website', id='website', value='#{user.profile.website}')
.form-group
@ -32,9 +32,13 @@ block content
button.btn.btn.btn-primary(type='submit')
span.ion-edit
| Update my profile
.panel
.container.text-center
a.btn.btn-cta.signup-btn.big-break(href='/') Take me to my current challenge
- if (!user.google || !user.facebook || !user.github || !user.linkedin || !user.twitter)
.panel
.container
.container.text-center
h1 Link other services to your account:
- if (!user.google)
.col-xs-12

View File

@ -29,7 +29,7 @@ block content
span.landing-icon.ion-ios7-people.text-primary(title='Help nonprofits')
.negative-45
p.landing-p Give nonprofits a boost by empowering them with code.
a.btn.btn-cta.signup-btn.btn-primary(href="/login") Start learning to code (it's free)
a.btn.btn-cta.signup-btn(href="/login") Start learning to code (it's free)
br
br
a.btn.nonprofit-cta.btn-success(href="/nonprofits") I'm with a nonprofit and want help coding something

View File

@ -74,7 +74,7 @@
br
br
.text-center
a.btn.btn-cta.signup-btn.cta.btn-primary(href="/login") Start learning to code (it's free)
a.btn.btn-cta.signup-btn.cta(href="/login") Start learning to code (it's free)
br
br
a.btn.nonprofit-cta.btn-success(href="/nonprofits") I'm with a nonprofit and want help coding something