Merge branch 'seafoodbuffet-configurable_auth'

* seafoodbuffet-configurable_auth:
  Replaced tabs to spaces
  Converted tabs to spaces
  enable localAuth
  introduce configurable login providers to selectively show/hide different login methods
This commit is contained in:
Sahat Yalkabov
2014-02-10 11:27:18 -05:00
4 changed files with 70 additions and 57 deletions

1
app.js
View File

@ -78,6 +78,7 @@ app.use(passport.session());
app.use(function(req, res, next) { app.use(function(req, res, next) {
res.locals.user = req.user; res.locals.user = req.user;
res.locals.token = req.csrfToken(); res.locals.token = req.csrfToken();
res.locals.secrets = secrets;
next(); next();
}); });
app.use(flash()); app.use(flash());

View File

@ -7,25 +7,31 @@ block content
legend Sign In legend Sign In
.form-group .form-group
.btn-group.btn-group-justified .btn-group.btn-group-justified
a.btn.btn-facebook(href='/auth/facebook') if secrets.facebookAuth
i.fa.fa-facebook a.btn.btn-facebook(href='/auth/facebook')
| Facebook i.fa.fa-facebook
a.btn.btn-twitter(href='/auth/twitter') | Facebook
i.fa.fa-twitter if secrets.twitterAuth
| Twitter a.btn.btn-twitter(href='/auth/twitter')
a.btn.btn-github(href='/auth/github') i.fa.fa-twitter
i.fa.fa-github | Twitter
| GitHub if secrets.githubAuth
a.btn.btn-google-plus(href='/auth/google') a.btn.btn-github(href='/auth/github')
i.fa.fa-google-plus i.fa.fa-github
| Google | GitHub
.form-group if secrets.googleAuth
label.control-label(for='email') Email a.btn.btn-google-plus(href='/auth/google')
input.form-control(type='text', name='email', id='email', placeholder='Email', autofocus=true) i.fa.fa-google-plus
.form-group | Google
label.control-label(for='password') Password if secrets.localAuth
input.form-control(type='password', name='password', id='password', placeholder='Password') .form-group
.form-group label.control-label(for='email') Email
button.btn.btn-primary(type='submit') input.form-control(type='text', name='email', id='email', placeholder='Email', autofocus=true)
i.fa.fa-unlock-alt .form-group
| Login label.control-label(for='password') Password
input.form-control(type='password', name='password', id='password', placeholder='Password')
.form-group
button.btn.btn-primary(type='submit')
i.fa.fa-unlock-alt
| Login

View File

@ -42,24 +42,25 @@ block content
| Update Profile | Update Profile
.page-header if secrets.localAuth
h3 Change Password .page-header
h3 Change Password
form.form-horizontal(action='/account/password', method='POST') form.form-horizontal(action='/account/password', method='POST')
input(type='hidden', name='_csrf', value=token) input(type='hidden', name='_csrf', value=token)
.form-group .form-group
label.col-sm-3.control-label(for='password') New Password label.col-sm-3.control-label(for='password') New Password
.col-sm-4 .col-sm-4
input.form-control(type='password', name='password', id='password') input.form-control(type='password', name='password', id='password')
.form-group .form-group
label.col-sm-3.control-label(for='confirmPassword') Confirm Password label.col-sm-3.control-label(for='confirmPassword') Confirm Password
.col-sm-4 .col-sm-4
input.form-control(type='password', name='confirmPassword', id='confirmPassword') input.form-control(type='password', name='confirmPassword', id='confirmPassword')
.form-group .form-group
.col-sm-offset-3.col-sm-4 .col-sm-offset-3.col-sm-4
button.btn.btn.btn-primary(type='submit') button.btn.btn.btn-primary(type='submit')
i.fa.fa-keyboard-o i.fa.fa-keyboard-o
| Change Password | Change Password
.page-header .page-header
h3 Delete Account h3 Delete Account
@ -74,22 +75,26 @@ block content
.page-header .page-header
h3 Linked Accounts h3 Linked Accounts
if user.google if secrets.googleAuth
p: a.text-danger(href='/account/unlink/google') Unlink your Google account if user.google
else p: a.text-danger(href='/account/unlink/google') Unlink your Google account
p: a(href='/auth/google') Link your Google account else
p: a(href='/auth/google') Link your Google account
if user.facebook if secrets.facebookAuth
p: a.text-danger(href='/account/unlink/facebook') Unlink your Facebook account if user.facebook
else p: a.text-danger(href='/account/unlink/facebook') Unlink your Facebook account
p: a(href='/auth/facebook') Link your Facebook account else
p: a(href='/auth/facebook') Link your Facebook account
if user.twitter if secrets.twitterAuth
p: a.text-danger(href='/account/unlink/twitter') Unlink your Twitter account if user.twitter
else p: a.text-danger(href='/account/unlink/twitter') Unlink your Twitter account
p: a(href='/auth/twitter') Link your Twitter account else
p: a(href='/auth/twitter') Link your Twitter account
if user.github if secrets.githubAuth
p: a.text-danger(href='/account/unlink/github') Unlink your GitHub account if user.github
else p: a.text-danger(href='/account/unlink/github') Unlink your GitHub account
p: a(href='/auth/github') Link your GitHub account else
p: a(href='/auth/github') Link your GitHub account

View File

@ -19,8 +19,9 @@
if !user if !user
li(class=title=='Login'?'active':undefined) li(class=title=='Login'?'active':undefined)
a(href='/login') Login a(href='/login') Login
li(class=title=='Create Account'?'active':undefined) if secrets.localAuth
a(href='/signup') Create Account li(class=title=='Create Account'?'active':undefined)
a(href='/signup') Create Account
else else
li.dropdown(class=title=='Account Management'?'active':undefined) li.dropdown(class=title=='Account Management'?'active':undefined)
a.dropdown-toggle(href='#', data-toggle='dropdown') a.dropdown-toggle(href='#', data-toggle='dropdown')