finished with profile page for now
This commit is contained in:
@ -89,6 +89,7 @@ passport.use(
|
|||||||
tokenSecret: tokenSecret
|
tokenSecret: tokenSecret
|
||||||
});
|
});
|
||||||
user.profile.name = user.profile.name || profile.displayName;
|
user.profile.name = user.profile.name || profile.displayName;
|
||||||
|
user.profile.username = user.profile.username || profile.username;
|
||||||
|
|
||||||
user.profile.location =
|
user.profile.location =
|
||||||
user.profile.location || profile._json.location;
|
user.profile.location || profile._json.location;
|
||||||
@ -117,6 +118,7 @@ passport.use(
|
|||||||
tokenSecret: tokenSecret
|
tokenSecret: tokenSecret
|
||||||
});
|
});
|
||||||
user.profile.name = user.profile.name || profile.displayName;
|
user.profile.name = user.profile.name || profile.displayName;
|
||||||
|
user.profile.username = user.profile.username || profile.username;
|
||||||
|
|
||||||
user.profile.location =
|
user.profile.location =
|
||||||
user.profile.location || profile._json.location;
|
user.profile.location || profile._json.location;
|
||||||
|
@ -181,8 +181,8 @@ exports.postUpdateProfile = function(req, res, next) {
|
|||||||
|
|
||||||
req.assert('email', 'Email is required').notEmpty();
|
req.assert('email', 'Email is required').notEmpty();
|
||||||
req.assert('email', 'Please enter a valid email address.').isEmail();
|
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 cannot be longer than 20 characters').len(1, 20);
|
||||||
req.assert('username', 'Your username can only use letters, numbers or underscores').matchRegex(/[A-Za-z0-9_]+/);
|
req.assert('username', 'Your username can only use letters, numbers or underscores').matchRegex(/^[A-z0-9_]+$/);
|
||||||
var errors = req.validationErrors();
|
var errors = req.validationErrors();
|
||||||
if (errors) {
|
if (errors) {
|
||||||
req.flash('errors', errors);
|
req.flash('errors', errors);
|
||||||
@ -208,8 +208,6 @@ exports.postUpdateProfile = function(req, res, next) {
|
|||||||
if (existingUsername && existingUsername.profile.username != user.profile.username) {
|
if (existingUsername && existingUsername.profile.username != user.profile.username) {
|
||||||
console.log(user.profile.username)
|
console.log(user.profile.username)
|
||||||
console.log(existingUsername.username)
|
console.log(existingUsername.username)
|
||||||
console.log(existingUsername.profile.username)
|
|
||||||
console.log(user.profile.username)
|
|
||||||
req.flash('errors', {
|
req.flash('errors', {
|
||||||
msg: 'An account with that username already exists.'
|
msg: 'An account with that username already exists.'
|
||||||
});
|
});
|
||||||
|
@ -261,6 +261,7 @@ ul {
|
|||||||
|
|
||||||
.btn-link-social {
|
.btn-link-social {
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
|
margin: auto;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,29 +2,29 @@ extends ../layout
|
|||||||
|
|
||||||
block content
|
block content
|
||||||
.panel
|
.panel
|
||||||
.container
|
.container.text-center
|
||||||
h1 Update your profile here:
|
h1 Update your profile here:
|
||||||
.animated.flipInX
|
.animated.flipInX
|
||||||
form.form-horizontal(action='/account/profile', method='POST')
|
form.form-horizontal(action='/account/profile', method='POST')
|
||||||
input(type='hidden', name='_csrf', value=_csrf)
|
input(type='hidden', name='_csrf', value=_csrf)
|
||||||
.form-group
|
.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
|
.col-sm-4
|
||||||
input.form-control(type='text', name='name', id='name', value='#{user.profile.name}')
|
input.form-control(type='text', name='name', id='name', value='#{user.profile.name}')
|
||||||
.form-group
|
.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
|
.col-sm-4
|
||||||
input.form-control(type='text', name='username', id='username', value='#{user.profile.username}')
|
input.form-control(type='text', name='username', id='username', value='#{user.profile.username}')
|
||||||
.form-group
|
.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
|
.col-sm-4
|
||||||
input.form-control(type='email', name='email', id='email', value='#{user.email}')
|
input.form-control(type='email', name='email', id='email', value='#{user.email}')
|
||||||
.form-group
|
.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
|
.col-sm-4
|
||||||
input.form-control(type='text', name='location', id='location', value='#{user.profile.location}')
|
input.form-control(type='text', name='location', id='location', value='#{user.profile.location}')
|
||||||
.form-group
|
.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
|
.col-sm-4
|
||||||
input.form-control(type='text', name='website', id='website', value='#{user.profile.website}')
|
input.form-control(type='text', name='website', id='website', value='#{user.profile.website}')
|
||||||
.form-group
|
.form-group
|
||||||
@ -32,9 +32,13 @@ block content
|
|||||||
button.btn.btn.btn-primary(type='submit')
|
button.btn.btn.btn-primary(type='submit')
|
||||||
span.ion-edit
|
span.ion-edit
|
||||||
| Update my profile
|
| 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)
|
- if (!user.google || !user.facebook || !user.github || !user.linkedin || !user.twitter)
|
||||||
.panel
|
.panel
|
||||||
.container
|
.container.text-center
|
||||||
h1 Link other services to your account:
|
h1 Link other services to your account:
|
||||||
- if (!user.google)
|
- if (!user.google)
|
||||||
.col-xs-12
|
.col-xs-12
|
||||||
|
@ -29,7 +29,7 @@ block content
|
|||||||
span.landing-icon.ion-ios7-people.text-primary(title='Help nonprofits')
|
span.landing-icon.ion-ios7-people.text-primary(title='Help nonprofits')
|
||||||
.negative-45
|
.negative-45
|
||||||
p.landing-p Give nonprofits a boost by empowering them with code.
|
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
|
||||||
br
|
br
|
||||||
a.btn.nonprofit-cta.btn-success(href="/nonprofits") I'm with a nonprofit and want help coding something
|
a.btn.nonprofit-cta.btn-success(href="/nonprofits") I'm with a nonprofit and want help coding something
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
br
|
br
|
||||||
br
|
br
|
||||||
.text-center
|
.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
|
||||||
br
|
br
|
||||||
a.btn.nonprofit-cta.btn-success(href="/nonprofits") I'm with a nonprofit and want help coding something
|
a.btn.nonprofit-cta.btn-success(href="/nonprofits") I'm with a nonprofit and want help coding something
|
||||||
|
Reference in New Issue
Block a user