introduce configurable login providers to selectively show/hide different login methods

This commit is contained in:
Cheng Zhou
2014-02-06 21:52:49 -06:00
parent 7a1af5afe8
commit ed70466c43
4 changed files with 72 additions and 60 deletions

1
app.js
View File

@ -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());

View File

@ -6,18 +6,23 @@ block content
legend Sign In
.form-group
.btn-group.btn-group-justified
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)

View File

@ -43,6 +43,7 @@ block content
| Update Profile
if secrets.localAuth
.page-header
h3 Change Password
@ -75,21 +76,25 @@ block content
.page-header
h3 Linked Accounts
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 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 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 secrets.githubAuth
if user.github
p: a.text-danger(href='/account/unlink/github') Unlink your GitHub account
else

View File

@ -19,6 +19,7 @@
if !user
li(class=title=='Login'?'active':undefined)
a(href='/login') Login
if secrets.localAuth
li(class=title=='Create Account'?'active':undefined)
a(href='/signup') Create Account
else