Added github signin/signup to the list of signups/signi's

This commit is contained in:
anooprh
2014-08-01 02:23:00 -04:00
parent ba0a6a0918
commit 3dcf45c55a
8 changed files with 142 additions and 76 deletions

View File

@@ -24,5 +24,10 @@ module.exports = {
clientID: process.env.LINKEDIN_ID || 'APP_ID',
clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
}
};
},
github: {
clientID: process.env.GITHUB_ID || 'APP_ID',
clientSecret: process.env.GITHUB_SECRET || 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
}
};

View File

@@ -39,5 +39,10 @@ module.exports = {
clientID: process.env.LINKEDIN_ID || 'APP_ID',
clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
}
};
},
github: {
clientID: process.env.GITHUB_ID || 'APP_ID',
clientSecret: process.env.GITHUB_SECRET || 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
}
};

9
config/env/test.js vendored
View File

@@ -25,5 +25,10 @@ module.exports = {
clientID: process.env.LINKEDIN_ID || 'APP_ID',
clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
}
};
},
github: {
clientID: process.env.GITHUB_ID || 'APP_ID',
clientSecret: process.env.GITHUB_SECRET || 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
}
};

View File

@@ -0,0 +1,42 @@
'use strict';
/**
* Module dependencies.
*/
var passport = require('passport'),
url = require('url'),
GithubStrategy = require('passport-github').Strategy,
config = require('../config'),
users = require('../../app/controllers/users');
module.exports = function() {
// Use github strategy
passport.use(new GithubStrategy({
clientID: config.github.clientID,
clientSecret: config.github.clientSecret,
callbackURL: config.github.callbackURL,
passReqToCallback: true
},
function(req, accessToken, refreshToken, profile, done) {
// Set the provider data and include tokens
var providerData = profile._json;
providerData.accessToken = accessToken;
providerData.refreshToken = refreshToken;
// Create the user OAuth profile
var providerUserProfile = {
firstName: profile.name.givenName,
lastName: profile.name.familyName,
displayName: profile.displayName,
email: profile.emails[0].value,
username: profile.username,
provider: 'github',
providerIdentifierField: 'id',
providerData: providerData
};
// Save the user OAuth profile
users.saveOAuthUserProfile(req, providerUserProfile, done);
}
));
};

View File

@@ -1,69 +1,70 @@
{
"name": "meanjs",
"description": "Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js.",
"version": "0.3.1",
"private": false,
"author": "https://github.com/meanjs/mean/graphs/contributors",
"repository": {
"type": "git",
"url": "https://github.com/meanjs/mean.git"
},
"engines": {
"node": "0.10.x",
"npm": "1.4.x"
},
"scripts": {
"start": "grunt",
"test": "grunt test",
"postinstall": "bower install --config.interactive=false"
},
"dependencies": {
"express": "~4.2.0",
"express-session": "~1.1.0",
"body-parser": "~1.2.0",
"cookie-parser": "~1.1.0",
"compression": "~1.0.1",
"method-override": "~1.0.0",
"morgan": "~1.1.0",
"connect-mongo": "~0.4.0",
"connect-flash": "~0.1.1",
"helmet": "~0.2.1",
"consolidate": "~0.10.0",
"swig": "~1.3.2",
"mongoose": "~3.8.8",
"passport": "~0.2.0",
"passport-local": "~1.0.0",
"passport-facebook": "~1.0.2",
"passport-twitter": "~1.0.2",
"passport-linkedin": "~0.1.3",
"passport-google-oauth": "~0.1.5",
"lodash": "~2.4.1",
"forever": "~0.11.0",
"bower": "~1.3.1",
"grunt-cli": "~0.1.13",
"glob": "~3.2.9"
},
"devDependencies": {
"supertest": "~0.12.1",
"should": "~3.3.1",
"grunt-env": "~0.4.1",
"grunt-node-inspector": "~0.1.3",
"grunt-contrib-watch": "~0.6.1",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-csslint": "^0.2.0",
"grunt-ngmin": "0.0.3",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-nodemon": "~0.2.1",
"grunt-concurrent": "~0.5.0",
"grunt-mocha-test": "~0.10.0",
"grunt-karma": "~0.8.2",
"load-grunt-tasks": "~0.4.0",
"karma": "~0.12.0",
"karma-jasmine": "~0.2.1",
"karma-coverage": "~0.2.0",
"karma-chrome-launcher": "~0.1.2",
"karma-firefox-launcher": "~0.1.3",
"karma-phantomjs-launcher": "~0.1.2"
}
}
"name": "meanjs",
"description": "Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js.",
"version": "0.3.1",
"private": false,
"author": "https://github.com/meanjs/mean/graphs/contributors",
"repository": {
"type": "git",
"url": "https://github.com/meanjs/mean.git"
},
"engines": {
"node": "0.10.x",
"npm": "1.4.x"
},
"scripts": {
"start": "grunt",
"test": "grunt test",
"postinstall": "bower install --config.interactive=false"
},
"dependencies": {
"body-parser": "~1.2.0",
"bower": "~1.3.1",
"compression": "~1.0.1",
"connect-flash": "~0.1.1",
"connect-mongo": "~0.4.0",
"consolidate": "~0.10.0",
"cookie-parser": "~1.1.0",
"express": "~4.2.0",
"express-session": "~1.1.0",
"forever": "~0.11.0",
"glob": "~3.2.9",
"grunt-cli": "~0.1.13",
"helmet": "~0.2.1",
"lodash": "~2.4.1",
"method-override": "~1.0.0",
"mongoose": "~3.8.8",
"morgan": "~1.1.0",
"passport": "~0.2.0",
"passport-facebook": "~1.0.2",
"passport-github": "^0.1.5",
"passport-google-oauth": "~0.1.5",
"passport-linkedin": "~0.1.3",
"passport-local": "~1.0.0",
"passport-twitter": "~1.0.2",
"swig": "~1.3.2"
},
"devDependencies": {
"supertest": "~0.12.1",
"should": "~3.3.1",
"grunt-env": "~0.4.1",
"grunt-node-inspector": "~0.1.3",
"grunt-contrib-watch": "~0.6.1",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-csslint": "^0.2.0",
"grunt-ngmin": "0.0.3",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-nodemon": "~0.2.1",
"grunt-concurrent": "~0.5.0",
"grunt-mocha-test": "~0.10.0",
"grunt-karma": "~0.8.2",
"load-grunt-tasks": "~0.4.0",
"karma": "~0.12.0",
"karma-jasmine": "~0.2.1",
"karma-coverage": "~0.2.0",
"karma-chrome-launcher": "~0.1.2",
"karma-firefox-launcher": "~0.1.3",
"karma-phantomjs-launcher": "~0.1.2"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@@ -13,6 +13,10 @@
<a href="/auth/linkedin" class="undecorated-link">
<img src="/modules/users/img/buttons/linkedin.png">
</a>
<a href="/auth/github" class="undecorated-link">
<img src="/modules/users/img/buttons/github.png">
</a>
</div>
<h3 class="col-md-12 text-center">Or with your account</h3>
<div class="col-xs-offset-2 col-xs-8 col-md-offset-5 col-md-2">
@@ -36,4 +40,4 @@
</fieldset>
</form>
</div>
</section>
</section>

View File

@@ -13,6 +13,10 @@
<a href="/auth/linkedin" class="undecorated-link">
<img src="/modules/users/img/buttons/linkedin.png">
</a>
<a href="/auth/github" class="undecorated-link">
<img src="/modules/users/img/buttons/github.png">
</a>
</div>
<h3 class="col-md-12 text-center">Or with your email</h3>
<div class="col-xs-offset-2 col-xs-8 col-md-offset-5 col-md-2">
@@ -48,4 +52,4 @@
</fieldset>
</form>
</div>
</section>
</section>