introduce configurable login providers to selectively show/hide different login methods
This commit is contained in:
1
app.js
1
app.js
@ -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());
|
||||||
|
@ -6,18 +6,23 @@ block content
|
|||||||
legend Sign In
|
legend Sign In
|
||||||
.form-group
|
.form-group
|
||||||
.btn-group.btn-group-justified
|
.btn-group.btn-group-justified
|
||||||
|
if secrets.facebookAuth
|
||||||
a.btn.btn-facebook(href='/auth/facebook')
|
a.btn.btn-facebook(href='/auth/facebook')
|
||||||
i.fa.fa-facebook
|
i.fa.fa-facebook
|
||||||
| Facebook
|
| Facebook
|
||||||
|
if secrets.twitterAuth
|
||||||
a.btn.btn-twitter(href='/auth/twitter')
|
a.btn.btn-twitter(href='/auth/twitter')
|
||||||
i.fa.fa-twitter
|
i.fa.fa-twitter
|
||||||
| Twitter
|
| Twitter
|
||||||
|
if secrets.githubAuth
|
||||||
a.btn.btn-github(href='/auth/github')
|
a.btn.btn-github(href='/auth/github')
|
||||||
i.fa.fa-github
|
i.fa.fa-github
|
||||||
| GitHub
|
| GitHub
|
||||||
|
if secrets.googleAuth
|
||||||
a.btn.btn-google-plus(href='/auth/google')
|
a.btn.btn-google-plus(href='/auth/google')
|
||||||
i.fa.fa-google-plus
|
i.fa.fa-google-plus
|
||||||
| Google
|
| Google
|
||||||
|
if secrets.localAuth
|
||||||
.form-group
|
.form-group
|
||||||
label.control-label(for='email') Email
|
label.control-label(for='email') Email
|
||||||
input.form-control(type='text', name='email', id='email', placeholder='Email', autofocus=true)
|
input.form-control(type='text', name='email', id='email', placeholder='Email', autofocus=true)
|
||||||
|
@ -43,6 +43,7 @@ block content
|
|||||||
| Update Profile
|
| Update Profile
|
||||||
|
|
||||||
|
|
||||||
|
if secrets.localAuth
|
||||||
.page-header
|
.page-header
|
||||||
h3 Change Password
|
h3 Change Password
|
||||||
|
|
||||||
@ -75,21 +76,25 @@ block content
|
|||||||
.page-header
|
.page-header
|
||||||
h3 Linked Accounts
|
h3 Linked Accounts
|
||||||
|
|
||||||
|
if secrets.googleAuth
|
||||||
if user.google
|
if user.google
|
||||||
p: a.text-danger(href='/account/unlink/google') Unlink your Google account
|
p: a.text-danger(href='/account/unlink/google') Unlink your Google account
|
||||||
else
|
else
|
||||||
p: a(href='/auth/google') Link your Google account
|
p: a(href='/auth/google') Link your Google account
|
||||||
|
|
||||||
|
if secrets.facebookAuth
|
||||||
if user.facebook
|
if user.facebook
|
||||||
p: a.text-danger(href='/account/unlink/facebook') Unlink your Facebook account
|
p: a.text-danger(href='/account/unlink/facebook') Unlink your Facebook account
|
||||||
else
|
else
|
||||||
p: a(href='/auth/facebook') Link your Facebook account
|
p: a(href='/auth/facebook') Link your Facebook account
|
||||||
|
|
||||||
|
if secrets.twitterAuth
|
||||||
if user.twitter
|
if user.twitter
|
||||||
p: a.text-danger(href='/account/unlink/twitter') Unlink your Twitter account
|
p: a.text-danger(href='/account/unlink/twitter') Unlink your Twitter account
|
||||||
else
|
else
|
||||||
p: a(href='/auth/twitter') Link your Twitter account
|
p: a(href='/auth/twitter') Link your Twitter account
|
||||||
|
|
||||||
|
if secrets.githubAuth
|
||||||
if user.github
|
if user.github
|
||||||
p: a.text-danger(href='/account/unlink/github') Unlink your GitHub account
|
p: a.text-danger(href='/account/unlink/github') Unlink your GitHub account
|
||||||
else
|
else
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
if !user
|
if !user
|
||||||
li(class=title=='Login'?'active':undefined)
|
li(class=title=='Login'?'active':undefined)
|
||||||
a(href='/login') Login
|
a(href='/login') Login
|
||||||
|
if secrets.localAuth
|
||||||
li(class=title=='Create Account'?'active':undefined)
|
li(class=title=='Create Account'?'active':undefined)
|
||||||
a(href='/signup') Create Account
|
a(href='/signup') Create Account
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user