Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
fix(users): Spacing Issues
Browse files Browse the repository at this point in the history
Fixes spacing issues with a couple server-side user module files.
  • Loading branch information
mleanos committed Sep 19, 2017
1 parent 6377a1e commit fabccc8
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 41 deletions.
48 changes: 24 additions & 24 deletions modules/users/server/config/strategies/google.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ module.exports = function (config) {
clientSecret: config.google.clientSecret,
callbackURL: config.google.callbackURL,
passReqToCallback: true,
scope: [ 'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email'
]
},
function (req, accessToken, refreshToken, profile, done) {
// Set the provider data and include tokens
var providerData = profile._json;
providerData.accessToken = accessToken;
providerData.refreshToken = refreshToken;
scope: ['https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email'
]
},
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,
profileImageURL: (providerData.picture) ? providerData.picture : undefined,
provider: 'google',
providerIdentifierField: 'id',
providerData: providerData
};
// 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,
profileImageURL: (providerData.picture) ? providerData.picture : undefined,
provider: 'google',
providerIdentifierField: 'id',
providerData: providerData
};

// Save the user OAuth profile
users.saveOAuthUserProfile(req, providerUserProfile, done);
}));
// Save the user OAuth profile
users.saveOAuthUserProfile(req, providerUserProfile, done);
}));
};
Original file line number Diff line number Diff line change
Expand Up @@ -84,33 +84,33 @@ exports.signout = function (req, res) {
* OAuth provider call
*/
exports.oauthCall = function (req, res, next) {
var strategy = req.params.strategy;
// Authenticate
passport.authenticate(strategy)(req, res, next);
};
var strategy = req.params.strategy;
// Authenticate
passport.authenticate(strategy)(req, res, next);
};

/**
* OAuth callback
*/
exports.oauthCallback = function (req, res, next) {
var strategy = req.params.strategy;
var strategy = req.params.strategy;

// info.redirect_to contains inteded redirect path
passport.authenticate(strategy, function (err, user, info) {
// info.redirect_to contains inteded redirect path
passport.authenticate(strategy, function (err, user, info) {
if (err) {
return res.redirect('/authentication/signin?err=' + encodeURIComponent(errorHandler.getErrorMessage(err)));
}
if (!user) {
return res.redirect('/authentication/signin');
}
req.login(user, function (err) {
if (err) {
return res.redirect('/authentication/signin?err=' + encodeURIComponent(errorHandler.getErrorMessage(err)));
}
if (!user) {
return res.redirect('/authentication/signin');
}
req.login(user, function (err) {
if (err) {
return res.redirect('/authentication/signin');
}

return res.redirect(info.redirect_to || '/');
});
})(req, res, next);
return res.redirect(info.redirect_to || '/');
});
})(req, res, next);
};

/**
Expand Down

0 comments on commit fabccc8

Please sign in to comment.