mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-29 10:39:19 +01:00
Merge commit '84ec1c80d283cbea8b186629e7b1de49d91cf9ba'
* commit '84ec1c80d283cbea8b186629e7b1de49d91cf9ba': fix(heroku): fix invalid app.json (#1901) feat(deps): dependencies upgrade (#1887) release(0.6.0): MEAN.JS 0.6.0 (#1863) feat(readme): Deploy to Heroku button (#1854) fix(users): Spacing Issues Abstracted OAuth routes to use req param to identify strategy & moved scope to actual strategy definition. Save profile images to Amazon S3 (#1857) fix(build): Require correct dependencies for prod build (#1855) fix(eslint): Make `space-before-function-paren` rule consistent with other rules (#1858) fix(gulpfile): show error on uglify (#1860) feat(core): Add manifest.json (#1851) # Conflicts: # CHANGELOG.md # README.md # modules/core/client/views/header.client.view.html # modules/users/client/views/settings/change-profile-picture.client.view.html # modules/users/server/controllers/users/users.profile.server.controller.js # package.json
This commit is contained in:
@@ -111,39 +111,34 @@ exports.signout = function (req, res) {
|
||||
/**
|
||||
* OAuth provider call
|
||||
*/
|
||||
exports.oauthCall = function (strategy, scope) {
|
||||
return function (req, res, next) {
|
||||
if (req.query && req.query.redirect_to)
|
||||
req.session.redirect_to = req.query.redirect_to;
|
||||
|
||||
// Authenticate
|
||||
passport.authenticate(strategy, scope)(req, res, next);
|
||||
};
|
||||
exports.oauthCall = function (req, res, next) {
|
||||
var strategy = req.params.strategy;
|
||||
// Authenticate
|
||||
passport.authenticate(strategy)(req, res, next);
|
||||
};
|
||||
|
||||
/**
|
||||
* OAuth callback
|
||||
*/
|
||||
exports.oauthCallback = function (strategy) {
|
||||
return function (req, res, next) {
|
||||
exports.oauthCallback = function (req, res, next) {
|
||||
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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user