mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-02-02 12:39:25 +01:00
Abstracted OAuth routes to use req param to identify strategy & moved scope to actual strategy definition.
This commit is contained in:
@@ -83,21 +83,17 @@ 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;
|
||||
|
||||
exports.oauthCall = function (req, res, next) {
|
||||
var strategy = req.params.strategy;
|
||||
// Authenticate
|
||||
passport.authenticate(strategy, scope)(req, res, next);
|
||||
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) {
|
||||
@@ -115,7 +111,6 @@ exports.oauthCallback = function (strategy) {
|
||||
return res.redirect(info.redirect_to || '/');
|
||||
});
|
||||
})(req, res, next);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user