diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/auth.js | 9 | ||||
-rw-r--r-- | lib/config.js | 2 | ||||
-rw-r--r-- | lib/models/user.js | 3 | ||||
-rw-r--r-- | lib/response.js | 6 |
4 files changed, 18 insertions, 2 deletions
diff --git a/lib/auth.js b/lib/auth.js index f4a0ec8f..76a962f5 100644 --- a/lib/auth.js +++ b/lib/auth.js @@ -6,6 +6,7 @@ var TwitterStrategy = require('passport-twitter').Strategy; var GithubStrategy = require('passport-github').Strategy; var GitlabStrategy = require('passport-gitlab2').Strategy; var DropboxStrategy = require('passport-dropbox-oauth2').Strategy; +var GoogleStrategy = require('passport-google-oauth20').Strategy; //core var config = require('./config.js'); @@ -100,4 +101,12 @@ if (config.dropbox) { clientSecret: config.dropbox.clientSecret, callbackURL: config.serverurl + '/auth/dropbox/callback' }, callback)); +} +//google +if (config.google) { + passport.use(new GoogleStrategy({ + clientID: config.google.clientID, + clientSecret: config.google.clientSecret, + callbackURL: config.serverurl + '/auth/google/callback' + }, callback)); }
\ No newline at end of file diff --git a/lib/config.js b/lib/config.js index cdaec31c..1f824d0a 100644 --- a/lib/config.js +++ b/lib/config.js @@ -61,6 +61,7 @@ var twitter = config.twitter || false; var github = config.github || false; var gitlab = config.gitlab || false; var dropbox = config.dropbox || false; +var google = config.google || false; var imgur = config.imgur || false; function getserverurl() { @@ -113,5 +114,6 @@ module.exports = { github: github, gitlab: gitlab, dropbox: dropbox, + google: google, imgur: imgur }; diff --git a/lib/models/user.js b/lib/models/user.js index 237532c1..3142a53d 100644 --- a/lib/models/user.js +++ b/lib/models/user.js @@ -76,6 +76,9 @@ module.exports = function (sequelize, DataTypes) { //no image api provided, use gravatar photo = 'https://www.gravatar.com/avatar/' + md5(profile.emails[0].value); break; + case "google": + photo = profile.photos[0].value.replace(/(\?sz=)\d*$/i, '$196'); + break; } return photo; } diff --git a/lib/response.js b/lib/response.js index 9c710751..062bc5db 100644 --- a/lib/response.js +++ b/lib/response.js @@ -96,7 +96,8 @@ function showIndex(req, res, next) { twitter: config.twitter, github: config.github, gitlab: config.gitlab, - dropbox: config.dropbox + dropbox: config.dropbox, + google: config.google }); res.write(content); res.end(); @@ -127,7 +128,8 @@ function responseHackMD(res, note) { twitter: config.twitter, github: config.github, gitlab: config.gitlab, - dropbox: config.dropbox + dropbox: config.dropbox, + google: config.google }); var buf = html; res.writeHead(200, { |