Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
5 changes: 5 additions & 0 deletions config/secrets.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
db: 'localhost',

localAuth: true,
sessionSecret: "Your Session Secret goes here",

sendgrid: {
Expand All @@ -17,27 +18,31 @@ module.exports = {
secret: 'Your API Secret'
},

facebookAuth: true,
facebook: {
clientID: 'Your App ID',
clientSecret: 'Your App Secret',
callbackURL: '/auth/facebook/callback',
passReqToCallback: true
},

githubAuth: true,
github: {
clientID: 'Your Client ID',
clientSecret: 'Your Client Secret',
callbackURL: '/auth/github/callback',
passReqToCallback: true
},

twitterAuth: true,
twitter: {
consumerKey: 'Your Consumer Key',
consumerSecret: 'Your Consumer Secret',
callbackURL: '/auth/twitter/callback',
passReqToCallback: true
},

googleAuth: true,
google: {
clientID: 'Your Client ID',
clientSecret: 'Your Client Secret',
Expand Down
50 changes: 28 additions & 22 deletions views/account/login.jade
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,31 @@ 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
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
button.btn.btn-primary(type='submit')
i.fa.fa-unlock-alt
| Login

73 changes: 39 additions & 34 deletions views/account/profile.jade
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,25 @@ block content
| Update Profile


.page-header
h3 Change Password

form.form-horizontal(action='/account/password', method='POST')
input(type='hidden', name='_csrf', value=token)
.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
.col-sm-offset-3.col-sm-4
button.btn.btn.btn-primary(type='submit')
i.fa.fa-keyboard-o
| Change Password
if secrets.localAuth
.page-header
h3 Change Password

form.form-horizontal(action='/account/password', method='POST')
input(type='hidden', name='_csrf', value=token)
.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
.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
Expand All @@ -74,22 +75,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
5 changes: 3 additions & 2 deletions views/partials/navigation.jade
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down