diff --git a/config/passport.js b/config/passport.js index 669876f1fc..ab1c7426a3 100644 --- a/config/passport.js +++ b/config/passport.js @@ -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; diff --git a/controllers/user.js b/controllers/user.js index 292f58d095..a21f414527 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -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.' }); diff --git a/public/css/main.less b/public/css/main.less index c8c06264e1..a24bef9717 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -261,6 +261,7 @@ ul { .btn-link-social { max-width: 400px; + margin: auto; margin-bottom: 10px; } diff --git a/views/account/profile.jade b/views/account/profile.jade index 0bbdefad7c..2c4ef1afb4 100644 --- a/views/account/profile.jade +++ b/views/account/profile.jade @@ -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 diff --git a/views/home.jade b/views/home.jade index fa627ad7f7..cc9dba64da 100644 --- a/views/home.jade +++ b/views/home.jade @@ -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 diff --git a/views/partials/faq.jade b/views/partials/faq.jade index 77690efe54..17fa041939 100644 --- a/views/partials/faq.jade +++ b/views/partials/faq.jade @@ -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