Merge remote-tracking branch 'origin/generator'

* origin/generator: (23 commits)
  Instagram generator indentation and whitespace fixes
  Minor adjustments to instagram generator, changed log color of already active auth methods to grey. (from yellow)
  Instagram auth generator!
  Renamed minimizer.js to generator.js
  Added Local authentication generator
  Removed if-check for local auth on change password form
  Added LinkedIn authentication generator
  Added Twitter authentication generator
  Added GitHub authentication generator
  Prettified generator CLI with unicode icons and multi-line message.
  Added Google add/remove generator
  Generator code cleanup
  Generator code refactoring
  Updated comment style to make it easier to generate the code using multiline strings
  Facebook User model add/remove complete
  add/remove facebook from profile template complete
  Removed auth if-checks
  Added login.jade add/remove facebook auth
  Removed if-checks, all authentications enabled by default
  Added terminal colors, info messages + code refactoring.
  ...
This commit is contained in:
Sahat Yalkabov
2014-04-14 12:39:10 -04:00
4 changed files with 1172 additions and 107 deletions

View File

@ -21,9 +21,7 @@ passport.deserializeUser(function(id, done) {
}); });
}); });
/** // Sign in using Email and Password.
* Sign in using Email and Password.
*/
passport.use(new LocalStrategy({ usernameField: 'email' }, function(email, password, done) { passport.use(new LocalStrategy({ usernameField: 'email' }, function(email, password, done) {
User.findOne({ email: email }, function(err, user) { User.findOne({ email: email }, function(err, user) {
@ -53,9 +51,7 @@ passport.use(new LocalStrategy({ usernameField: 'email' }, function(email, passw
* - Else create a new account. * - Else create a new account.
*/ */
/** // Sign in with Facebook.
* Sign in with Facebook.
*/
passport.use(new FacebookStrategy(secrets.facebook, function(req, accessToken, refreshToken, profile, done) { passport.use(new FacebookStrategy(secrets.facebook, function(req, accessToken, refreshToken, profile, done) {
if (req.user) { if (req.user) {
@ -102,9 +98,7 @@ passport.use(new FacebookStrategy(secrets.facebook, function(req, accessToken, r
} }
})); }));
/** // Sign in with GitHub.
* Sign in with GitHub.
*/
passport.use(new GitHubStrategy(secrets.github, function(req, accessToken, refreshToken, profile, done) { passport.use(new GitHubStrategy(secrets.github, function(req, accessToken, refreshToken, profile, done) {
if (req.user) { if (req.user) {
@ -152,9 +146,7 @@ passport.use(new GitHubStrategy(secrets.github, function(req, accessToken, refre
} }
})); }));
/** // Sign in with Twitter.
* Sign in with Twitter.
*/
passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tokenSecret, profile, done) { passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tokenSecret, profile, done) {
if (req.user) { if (req.user) {
@ -197,9 +189,7 @@ passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tok
} }
})); }));
/** // Sign in with Google.
* Sign in with Google.
*/
passport.use(new GoogleStrategy(secrets.google, function(req, accessToken, refreshToken, profile, done) { passport.use(new GoogleStrategy(secrets.google, function(req, accessToken, refreshToken, profile, done) {
if (req.user) { if (req.user) {
@ -245,9 +235,7 @@ passport.use(new GoogleStrategy(secrets.google, function(req, accessToken, refre
} }
})); }));
/** // Sign in with LinkedIn.
* Sign in with LinkedIn.
*/
passport.use(new LinkedInStrategy(secrets.linkedin, function(req, accessToken, refreshToken, profile, done) { passport.use(new LinkedInStrategy(secrets.linkedin, function(req, accessToken, refreshToken, profile, done) {
if (req.user) { if (req.user) {
@ -298,10 +286,7 @@ passport.use(new LinkedInStrategy(secrets.linkedin, function(req, accessToken, r
} }
})); }));
/** // Tumblr API setup.
* Tumblr API
* Uses OAuth 1.0a Strategy.
*/
passport.use('tumblr', new OAuthStrategy({ passport.use('tumblr', new OAuthStrategy({
requestTokenURL: 'http://www.tumblr.com/oauth/request_token', requestTokenURL: 'http://www.tumblr.com/oauth/request_token',
@ -322,10 +307,7 @@ passport.use('tumblr', new OAuthStrategy({
} }
)); ));
/** // Foursquare API setup.
* Foursquare API
* Uses OAuth 2.0 Strategy.
*/
passport.use('foursquare', new OAuth2Strategy({ passport.use('foursquare', new OAuth2Strategy({
authorizationURL: 'https://foursquare.com/oauth2/authorize', authorizationURL: 'https://foursquare.com/oauth2/authorize',
@ -345,10 +327,7 @@ passport.use('foursquare', new OAuth2Strategy({
} }
)); ));
/** // Venmo API setup.
* Venmo API
* Uses OAuth 2.0 Strategy.
*/
passport.use('venmo', new OAuth2Strategy({ passport.use('venmo', new OAuth2Strategy({
authorizationURL: 'https://api.venmo.com/v1/oauth/authorize', authorizationURL: 'https://api.venmo.com/v1/oauth/authorize',

1099
generator.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -5,36 +5,30 @@ block content
legend Sign In legend Sign In
input(type='hidden', name='_csrf', value=_csrf) input(type='hidden', name='_csrf', value=_csrf)
.col-sm-8.col-sm-offset-2 .col-sm-8.col-sm-offset-2
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) .form-group
.form-group label.control-label(for='password') Password
label.control-label(for='password') Password input.form-control(type='password', name='password', id='password', placeholder='Password')
input.form-control(type='password', name='password', id='password', placeholder='Password') .form-group
.form-group button.btn.btn-primary(type='submit')
button.btn.btn-primary(type='submit') i.fa.fa-unlock-alt
i.fa.fa-unlock-alt | Login
| Login a.btn.btn-link(href='/forgot') Forgot your password?
a.btn.btn-link(href='/forgot') Forgot your password? hr
hr a.btn.btn-block.btn-facebook.btn-social(href='/auth/facebook')
if secrets.facebookAuth i.fa.fa-facebook
a.btn.btn-block.btn-facebook.btn-social(href='/auth/facebook') | Sign in with Facebook
i.fa.fa-facebook a.btn.btn-block.btn-twitter.btn-social(href='/auth/twitter')
| Sign in with Facebook i.fa.fa-twitter
if secrets.twitterAuth | Sign in with Twitter
a.btn.btn-block.btn-twitter.btn-social(href='/auth/twitter') a.btn.btn-block.btn-google-plus.btn-social(href='/auth/google')
i.fa.fa-twitter i.fa.fa-google-plus
| Sign in with Twitter | Sign in with Google
if secrets.googleAuth a.btn.btn-block.btn-github.btn-social(href='/auth/github')
a.btn.btn-block.btn-google-plus.btn-social(href='/auth/google') i.fa.fa-github
i.fa.fa-google-plus | Sign in with GitHub
| Sign in with Google a.btn.btn-block.btn-linkedin.btn-social(href='/auth/linkedin')
if secrets.githubAuth i.fa.fa-linkedin
a.btn.btn-block.btn-github.btn-social(href='/auth/github') | Sign in with LinkedIn
i.fa.fa-github
| Sign in with GitHub
if secrets.linkedinAuth
a.btn.btn-block.btn-linkedin.btn-social(href='/auth/linkedin')
i.fa.fa-linkedin
| Sign in with LinkedIn

View File

@ -41,26 +41,24 @@ block content
i.fa.fa-magnet i.fa.fa-magnet
| Update Profile | Update Profile
.page-header
h3 Change Password
if secrets.localAuth form.form-horizontal(action='/account/password', method='POST')
.page-header input(type='hidden', name='_csrf', value=_csrf)
h3 Change Password .form-group
label.col-sm-3.control-label(for='password') New Password
form.form-horizontal(action='/account/password', method='POST') .col-sm-4
input(type='hidden', name='_csrf', value=_csrf) input.form-control(type='password', name='password', id='password')
.form-group .form-group
label.col-sm-3.control-label(for='password') New Password label.col-sm-3.control-label(for='confirmPassword') Confirm Password
.col-sm-4 .col-sm-4
input.form-control(type='password', name='password', id='password') input.form-control(type='password', name='confirmPassword', id='confirmPassword')
.form-group .form-group
label.col-sm-3.control-label(for='confirmPassword') Confirm Password .col-sm-offset-3.col-sm-4
.col-sm-4 button.btn.btn.btn-primary(type='submit')
input.form-control(type='password', name='confirmPassword', id='confirmPassword') i.fa.fa-keyboard-o
.form-group | Change Password
.col-sm-offset-3.col-sm-4
button.btn.btn.btn-primary(type='submit')
i.fa.fa-keyboard-o
| Change Password
.page-header .page-header
h3 Delete Account h3 Delete Account
@ -75,32 +73,27 @@ 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 p: a(href='/auth/github') Link your GitHub account
p: a(href='/auth/github') Link your GitHub account
if secrets.linkedinAuth if user.linkedin
if user.linkedin p: a.text-danger(href='/account/unlink/linkedin') Unlink your LinkedIn account
p: a.text-danger(href='/account/unlink/linkedin') Unlink your LinkedIn account else
else p: a(href='/auth/linkedin') Link your LinkedIn account
p: a(href='/auth/linkedin') Link your LinkedIn account