diff --git a/app.js b/app.js index 7625775811..0ab040ccd0 100755 --- a/app.js +++ b/app.js @@ -78,6 +78,7 @@ app.use(passport.session()); app.use(function(req, res, next) { res.locals.user = req.user; res.locals.token = req.csrfToken(); + res.locals.secrets = secrets; next(); }); app.use(flash()); diff --git a/views/account/login.jade b/views/account/login.jade index c8d2076b04..a97954cdc8 100644 --- a/views/account/login.jade +++ b/views/account/login.jade @@ -6,27 +6,32 @@ block content legend Sign In .form-group .btn-group.btn-group-justified - a.btn.btn-facebook(href='/auth/facebook') - i.fa.fa-facebook - | Facebook - a.btn.btn-twitter(href='/auth/twitter') - i.fa.fa-twitter - | Twitter - a.btn.btn-github(href='/auth/github') - i.fa.fa-github - | GitHub - a.btn.btn-google-plus(href='/auth/google') - i.fa.fa-google-plus - | Google - .form-group - label.control-label(for='email') Email - input.form-control(type='text', name='email', id='email', placeholder='Email', autofocus=true) - .form-group - label.control-label(for='password') Password - input.form-control(type='password', name='password', id='password', placeholder='Password') - .form-group - input.form-control(type='hidden', name='_csrf', value=token) - .form-group - button.btn.btn-primary(type='submit') - i.fa.fa-unlock-alt - | Login + if secrets.facebookAuth + a.btn.btn-facebook(href='/auth/facebook') + i.fa.fa-facebook + | Facebook + if secrets.twitterAuth + a.btn.btn-twitter(href='/auth/twitter') + i.fa.fa-twitter + | Twitter + if secrets.githubAuth + a.btn.btn-github(href='/auth/github') + i.fa.fa-github + | GitHub + if secrets.googleAuth + a.btn.btn-google-plus(href='/auth/google') + i.fa.fa-google-plus + | Google + if secrets.localAuth + .form-group + label.control-label(for='email') Email + input.form-control(type='text', name='email', id='email', placeholder='Email', autofocus=true) + .form-group + label.control-label(for='password') Password + input.form-control(type='password', name='password', id='password', placeholder='Password') + .form-group + input.form-control(type='hidden', name='_csrf', value=token) + .form-group + button.btn.btn-primary(type='submit') + i.fa.fa-unlock-alt + | Login diff --git a/views/account/profile.jade b/views/account/profile.jade index b00cd9dcf9..fb8d6ace79 100644 --- a/views/account/profile.jade +++ b/views/account/profile.jade @@ -43,25 +43,26 @@ block content | Update Profile - .page-header - h3 Change Password + if secrets.localAuth + .page-header + h3 Change Password - form.form-horizontal(action='/account/password', method='POST') - .form-group - label.col-sm-3.control-label(for='password') New Password - .col-sm-4 - input.form-control(type='password', name='password', id='password') - .form-group - label.col-sm-3.control-label(for='confirmPassword') Confirm Password - .col-sm-4 - input.form-control(type='password', name='confirmPassword', id='confirmPassword') - .form-group - input.form-control(type='hidden', name='_csrf', value=token) - .form-group - .col-sm-offset-3.col-sm-4 - button.btn.btn.btn-primary(type='submit') - i.fa.fa-keyboard-o - | Change Password + form.form-horizontal(action='/account/password', method='POST') + .form-group + label.col-sm-3.control-label(for='password') New Password + .col-sm-4 + input.form-control(type='password', name='password', id='password') + .form-group + label.col-sm-3.control-label(for='confirmPassword') Confirm Password + .col-sm-4 + input.form-control(type='password', name='confirmPassword', id='confirmPassword') + .form-group + input.form-control(type='hidden', name='_csrf', value=token) + .form-group + .col-sm-offset-3.col-sm-4 + button.btn.btn.btn-primary(type='submit') + i.fa.fa-keyboard-o + | Change Password .page-header h3 Delete Account @@ -75,22 +76,26 @@ block content .page-header h3 Linked Accounts - if user.google - p: a.text-danger(href='/account/unlink/google') Unlink your Google account - else - p: a(href='/auth/google') Link your Google account + if secrets.googleAuth + if user.google + p: a.text-danger(href='/account/unlink/google') Unlink your Google account + else + p: a(href='/auth/google') Link your Google account - if user.facebook - p: a.text-danger(href='/account/unlink/facebook') Unlink your Facebook account - else - p: a(href='/auth/facebook') Link your Facebook account + if secrets.facebookAuth + if user.facebook + p: a.text-danger(href='/account/unlink/facebook') Unlink your Facebook account + else + p: a(href='/auth/facebook') Link your Facebook account - if user.twitter - p: a.text-danger(href='/account/unlink/twitter') Unlink your Twitter account - else - p: a(href='/auth/twitter') Link your Twitter account + if secrets.twitterAuth + if user.twitter + p: a.text-danger(href='/account/unlink/twitter') Unlink your Twitter account + else + p: a(href='/auth/twitter') Link your Twitter account - if user.github - p: a.text-danger(href='/account/unlink/github') Unlink your GitHub account - else - p: a(href='/auth/github') Link your GitHub account + if secrets.githubAuth + if user.github + p: a.text-danger(href='/account/unlink/github') Unlink your GitHub account + else + p: a(href='/auth/github') Link your GitHub account diff --git a/views/partials/navigation.jade b/views/partials/navigation.jade index 3b29aa5f44..c157ac7cd9 100644 --- a/views/partials/navigation.jade +++ b/views/partials/navigation.jade @@ -19,8 +19,9 @@ if !user li(class=title=='Login'?'active':undefined) a(href='/login') Login - li(class=title=='Create Account'?'active':undefined) - a(href='/signup') Create Account + if secrets.localAuth + li(class=title=='Create Account'?'active':undefined) + a(href='/signup') Create Account else li.dropdown(class=title=='Account Management'?'active':undefined) a.dropdown-toggle(href='#', data-toggle='dropdown')