diff --git a/config/passport.js b/config/passport.js index 5870421045d..d8a04146b79 100644 --- a/config/passport.js +++ b/config/passport.js @@ -12,20 +12,13 @@ var _ = require('lodash'), nodemailer = require('nodemailer'), secrets = require('./secrets'); -// Login Required middleware. -module.exports = { - isAuthenticated: isAuthenticated, - isAuthorized: isAuthorized -}; passport.serializeUser(function(user, done) { done(null, user.id); }); passport.deserializeUser(function(id, done) { - User.findOne({ - _id: id - }, '-password', function(err, user) { + User.findById(id, function(err, user) { done(err, user); }); }); @@ -381,12 +374,16 @@ passport.use(new LinkedInStrategy(secrets.linkedin, function(req, accessToken, r } })); -function isAuthenticated(req, res, next) { +// Login Required middleware. + +exports.isAuthenticated = function(req, res, next) { if (req.isAuthenticated()) return next(); res.redirect('/login'); -} +}; -function isAuthorized(req, res, next) { +// Authorization Required middleware. + +exports.isAuthorized = function(req, res, next) { var provider = req.path.split('/').slice(-1)[0]; if (_.find(req.user.tokens, { kind: provider })) { @@ -394,4 +391,4 @@ function isAuthorized(req, res, next) { } else { res.redirect('/auth/' + provider); } -} +}; \ No newline at end of file diff --git a/views/account/forgot.jade b/views/account/forgot.jade index a843a1e95bf..cc7f131cccc 100644 --- a/views/account/forgot.jade +++ b/views/account/forgot.jade @@ -1,15 +1,16 @@ extends ../layout block content - .col-sm-8.col-sm-offset-2 - form(method='POST') - legend Forgot Password - input(type='hidden', name='_csrf', value=_csrf) - .form-group - p Enter your email address below and we will send you password reset instructions. - label.control-label(for='email') Email - input.form-control(type='email', name='email', id='email', placeholder='Email', autofocus=true) - .form-group - button.btn.btn-primary(type='submit') - i.fa.fa-key - | Reset Password + .jumbotron + .col-sm-8.col-sm-offset-2 + form(method='POST') + h1 Forgot Password + input(type='hidden', name='_csrf', value=_csrf) + .form-group + p Enter your email address below and we will send you password reset instructions. + label.control-label(for='email') Email + input.form-control(type='email', name='email', id='email', placeholder='Email', autofocus=true) + .form-group + button.btn.btn-primary(type='submit') + i.fa.fa-key + | Reset Password diff --git a/views/account/profile.jade b/views/account/profile.jade index b51b83b9f20..0c8ab97bb68 100644 --- a/views/account/profile.jade +++ b/views/account/profile.jade @@ -243,11 +243,11 @@ block content a.btn.btn-lg.btn-block.btn-facebook.btn-link-social(href='/auth/facebook') i.fa.fa-facebook | Link Facebook with your account - //- if (!user.github) - // .col-xs-12 - // a.btn.btn-lg.btn-block.btn-github.btn-link-social(href='/auth/github') - // i.fa.fa-github - // | Link GitHub with your account + - if (!user.github) + .col-xs-12 + a.btn.btn-lg.btn-block.btn-github.btn-link-social(href='/auth/github') + i.fa.fa-github + | Link GitHub with your account - if (!user.linkedin) .col-xs-12 a.btn.btn-lg.btn-block.btn-linkedin.btn-link-social(href='/auth/linkedin')