Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// defaults can be overriden, but I don't see a reason why you'd want to
// do that.
_.extend(options, strategies[key].options);
self.use(new Strategy(options, self.protocols[protocol]));
}
});
};
/**
* Disconnect a passport from a user
*
* @param {Object} req
* @param {Object} res
*/
passport.disconnect = function (req, res, next) {
var user = req.user
, provider = req.param('provider');
Passport.findOne({
provider : provider,
user : user.id
}, function (err, passport) {
if (err) {
return next(err);
}
Passport.destroy(passport.id, function (error) {
if (err) {
return next(err);
}
// defaults can be overriden, but I don't see a reason why you'd want to
// do that.
_.extend(options, strategies[key].options);
passport.use(new Strategy(options, this.protocols[protocol]));
}
}, passport));
};
/**
* Disconnect a passport from a user
*
* @param {Object} req
* @param {Object} res
*/
passport.disconnect = function (req, res, next) {
var user = req.user;
var provider = req.param('provider');
return sails.models.passport.findOne({
provider: provider,
user: user.id
})
.then(function (passport) {
return sails.models.passport.destroy(passport.id);
})
.then(function (error) {
next(null, user);
return user;
})
.catch(next);
};
// defaults can be overriden, but I don't see a reason why you'd want to
// do that.
_.extend(options, strategies[key].options);
self.use(new Strategy(options, self.protocols[protocol]));
}
});
};
/**
* Disconnect a passport from a user
*
* @param {Object} req
* @param {Object} res
*/
passport.disconnect = function (req, res, next) {
var user = req.user
, provider = req.param('provider', 'local')
, query = {};
query.user = user.id;
query[provider === 'local' ? 'protocol' : 'provider'] = provider;
Passport.findOne(query, function (err, passport) {
if (err) {
return next(err);
}
Passport.destroy(passport.id, function (error) {
if (err) {
return next(err);
}
// defaults can be overriden, but I don't see a reason why you'd want to
// do that.
_.extend(options, strategies[key].options);
self.use(new Strategy(options, self.protocols[protocol]));
}
});
};
/**
* Disconnect a passport from a user
*
* @param {Object} req
* @param {Object} res
*/
passport.disconnect = function (req, res, next) {
var user = req.user
, provider = req.param('provider', 'local')
, query = {};
query.user = user.id;
query[provider === 'local' ? 'protocol' : 'provider'] = provider;
Passport.findOne(query, function (err, passport) {
if (err) {
return next(err);
}
Passport.destroy(passport.id, function (error) {
if (err) {
return next(err);
}
// defaults can be overriden, but I don't see a reason why you'd want to
// do that.
_.extend(options, strategies[key].options);
self.use(new Strategy(options, self.protocols[protocol]));
}
});
};
/**
* Disconnect a passport from a user
*
* @param {Object} req
* @param {Object} res
*/
passport.disconnect = function (req, res, next) {
const user = req.user,
provider = req.param('provider', 'local'),
query = {};
query.user = user.name;
query[provider === 'local' ? 'protocol' : 'provider'] = provider;
Passport.findOne(query, function (err, passport) {
if (err) {
return next(err);
}
Passport.destroy(passport.id, function (error) {
if (error) {
return next(error);
}
// defaults can be overriden, but I don't see a reason why you'd want to
// do that.
_.extend(options, strategies[key].options);
self.use(new Strategy(options, self.protocols[protocol]));
}
});
};
/**
* Disconnect a passport from a user
*
* @param {Object} req
* @param {Object} res
*/
passport.disconnect = function (req, res, next) {
var user = req.user
, provider = req.param('provider');
Passport.findOne({
provider : provider,
user : user.id
}, function (err, passport) {
if (err) {
return next(err);
}
Passport.destroy(passport.id, function (error) {
if (err) {
return next(err);
}