diff --git a/config/passport.js b/config/passport.js index 04b02132b1..3a0d8316af 100755 --- a/config/passport.js +++ b/config/passport.js @@ -18,7 +18,7 @@ passport.deserializeUser(function(id, done) { }); passport.use(new LocalStrategy({ - usernameField: 'email' + usernameField: 'usernameEmail' }, function(email, password, done) { User.findOne({ email: email }, function(err, user) { diff --git a/controllers/user.js b/controllers/user.js index e3715ecae1..0f73aa52f2 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -33,10 +33,7 @@ exports.getLogin = function(req, res) { */ exports.postLogin = function(req, res, next) { passport.authenticate('local', function(err, user, info) { - if (err) { - console.log(err); - return next(err); - } + if (err) return next(err); if (!user) { req.flash('messages', info.message); return res.redirect('/login'); diff --git a/views/login.jade b/views/login.jade index 280bf015ca..ee8292e4d8 100644 --- a/views/login.jade +++ b/views/login.jade @@ -1,46 +1,43 @@ extends layout block content - .login-wrapper - .login-container - h3.text-center - span.text-primary PROJECT - span.text-muted NAME - form(method='POST') - .form-group - input.form-control(type='text', name='usernameOrEmail', id='usernameOrEmail', placeholder='Username or Email', autofocus='') - .form-group - input.form-control(type='password', name='password', id='password', placeholder='Password') - button(type='submit') - i.fa.fa-chevron-right - .form-options.clearfix - a.pull-right(href='#') Forgot password? - .text-left - label.checkbox - input(type='checkbox') - span Remember me - .row - .col-xs-6.col-sm-6.col-md-6 - a.btn.btn-primary.btn-block.facebook(href='/auth/facebook') - i.fa.fa-facebook - | Facebook - .col-xs-6.col-sm-6.col-md-6 - a.btn.btn-danger.btn-block.google(href='/auth/google') - i.fa.fa-google-plus - |   Google - .row - .col-xs-6.col-sm-6.col-md-6 - a.btn.btn-info.btn-block.twitter(href='/auth/twitter') - i.fa.fa-twitter - |   Twitter - .col-xs-6.col-sm-6.col-md-6 - a.btn.btn-default.btn-block.github(href='/auth/github') - i.fa.fa-github - |   GitHub - p Don't have an account yet?  - a(href='/signup') Sign up now - - - if messages.length - .alert.alert-danger - strong= messages \ No newline at end of file + if messages.length + .alert.alert-danger + strong= messages + .login-container + h3.text-center + span.text-primary PROJECT + span.text-muted NAME + form(method='POST') + .form-group + input.form-control(type='text', name='usernameEmail', id='usernameEmail', placeholder='Username or Email', autofocus='') + .form-group + input.form-control(type='password', name='password', id='password', placeholder='Password') + button(type='submit') + i.fa.fa-chevron-right + .form-options.clearfix + a.pull-right(href='#') Forgot password? + .text-left + label.checkbox + input(type='checkbox') + span Remember me + .row + .col-xs-6.col-sm-6.col-md-6 + a.btn.btn-primary.btn-block.facebook(href='/auth/facebook') + i.fa.fa-facebook + | Facebook + .col-xs-6.col-sm-6.col-md-6 + a.btn.btn-danger.btn-block.google(href='/auth/google') + i.fa.fa-google-plus + |   Google + .row + .col-xs-6.col-sm-6.col-md-6 + a.btn.btn-info.btn-block.twitter(href='/auth/twitter') + i.fa.fa-twitter + |   Twitter + .col-xs-6.col-sm-6.col-md-6 + a.btn.btn-default.btn-block.github(href='/auth/github') + i.fa.fa-github + |   GitHub + p Don't have an account yet?  + a(href='/signup') Sign up now \ No newline at end of file