may have fixed email forms

This commit is contained in:
Michael Q Larson
2014-11-30 00:10:21 -08:00
parent 6a0b6bb315
commit abeebb9991
3 changed files with 8 additions and 16 deletions

View File

@ -88,7 +88,7 @@ exports.postSignup = function(req, res, next) {
if (errors) { if (errors) {
req.flash('errors', errors); req.flash('errors', errors);
return res.redirect('/signup'); return res.redirect('/login');
} }
var user = new User({ var user = new User({
@ -99,7 +99,7 @@ exports.postSignup = function(req, res, next) {
User.findOne({ email: req.body.email }, function(err, existingUser) { User.findOne({ email: req.body.email }, function(err, existingUser) {
if (existingUser) { if (existingUser) {
req.flash('errors', { msg: 'Account with that email address already exists.' }); req.flash('errors', { msg: 'Account with that email address already exists.' });
return res.redirect('/signup'); return res.redirect('/login');
} }
user.save(function(err) { user.save(function(err) {
if (err) return next(err); if (err) return next(err);

View File

@ -19,18 +19,15 @@ block content
| Sign in with Twitter | Sign in with Twitter
hr hr
h2 Sign up with an email address here: h2 Sign up with an email address here:
form.form-horizontal(id='signup-form', method='POST') form.form-horizontal(id='signup-form', action='signup', method='POST')
input(type='hidden', name='_csrf', value=_csrf) input(type='hidden', name='_csrf', value=_csrf)
.form-group .form-group
//label.col-sm-3.control-label(for='email') Email
.col-sm-6.col-sm-offset-3 .col-sm-6.col-sm-offset-3
input.form-control(type='email', name='email', id='email', placeholder='Email', autofocus) input.form-control(type='email', name='email', id='email', placeholder='Email', autofocus=true)
.form-group .form-group
//label.col-sm-3.control-label(for='password') Password
.col-sm-6.col-sm-offset-3 .col-sm-6.col-sm-offset-3
input.form-control(type='password', name='password', id='password', placeholder='Password') input.form-control(type='password', name='password', id='password', placeholder='Password')
.form-group .form-group
//label.col-sm-3.control-label(for='confirmPassword') Confirm Password
.col-sm-6.col-sm-offset-3 .col-sm-6.col-sm-offset-3
input.form-control(type='password', name='confirmPassword', id='confirmPassword', placeholder='Confirm Password') input.form-control(type='password', name='confirmPassword', id='confirmPassword', placeholder='Confirm Password')
.form-group .form-group
@ -40,19 +37,17 @@ block content
| Sign up | Sign up
hr hr
h2 Sign in with an email address here: h2 Sign in with an email address here:
form(method='POST') form(action='login', method='POST')
input(type='hidden', name='_csrf', value=_csrf) input(type='hidden', name='_csrf', value=_csrf)
.col-sm-6.col-sm-offset-3 .col-sm-6.col-sm-offset-3
.form-group .form-group
//label.control-label(for='email') Email input.form-control(type='email', name='email', id='email', placeholder='Email')
input.form-control(type='email', name='email', id='email', placeholder='Email', autofocus=true)
.form-group .form-group
//label.control-label(for='password') Password
input.form-control(type='password', name='password', id='password', placeholder='Password') input.form-control(type='password', name='password', id='password', placeholder='Password')
.form-group .form-group
button.btn.btn-primary(type='submit') button.btn.btn-primary(type='submit')
span.ion-android-hand span.ion-android-hand
| Login | Sign in
span    span   
a.btn.btn-info(href='/forgot') Forgot your password? a.btn.btn-info(href='/forgot') Forgot your password?
br br

View File

@ -22,15 +22,12 @@ block content
form.form-horizontal(id='signup-form', method='POST') form.form-horizontal(id='signup-form', method='POST')
input(type='hidden', name='_csrf', value=_csrf) input(type='hidden', name='_csrf', value=_csrf)
.form-group .form-group
//label.col-sm-3.control-label(for='email') Email
.col-sm-6.col-sm-offset-3 .col-sm-6.col-sm-offset-3
input.form-control(type='email', name='email', id='email', placeholder='Email', autofocus) input.form-control(type='email', name='email', id='email', placeholder='Email', autofocus)
.form-group .form-group
//label.col-sm-3.control-label(for='password') Password
.col-sm-6.col-sm-offset-3 .col-sm-6.col-sm-offset-3
input.form-control(type='password', name='password', id='password', placeholder='Password') input.form-control(type='password', name='password', id='password', placeholder='Password')
.form-group .form-group
//label.col-sm-3.control-label(for='confirmPassword') Confirm Password
.col-sm-6.col-sm-offset-3 .col-sm-6.col-sm-offset-3
input.form-control(type='password', name='confirmPassword', id='confirmPassword', placeholder='Confirm Password') input.form-control(type='password', name='confirmPassword', id='confirmPassword', placeholder='Confirm Password')
.form-group .form-group