Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

passport

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

.travis.yml

2

lib/passport/context/http/actions.js

@@ -20,3 +20,3 @@ /**

*/
actions.success = function(user, profile) {
actions.success = function(user, info) {
this.delegate.success.apply(this, arguments);

@@ -23,0 +23,0 @@ }

@@ -28,8 +28,7 @@ /**

* authenticated user on a successful authentication attempt, or `false`
* otherwise. An optional `profile` will be provided, containing
* service-specific profile information, when using third-party authentication
* strategies.
* otherwise. An optional `info` argument will be passed, containing additional
* details provided by the strategy's verify callback.
*
* app.get('/protected', function(req, res, next) {
* passport.authenticate('local', function(err, user, profile) {
* passport.authenticate('local', function(err, user, info) {
* if (err) { return next(err) }

@@ -71,6 +70,21 @@ * if (!user) { return res.redirect('/signin') }

var delegate = {};
delegate.success = function(user, profile) {
delegate.success = function(user, info) {
if (callback) {
return callback(null, user, profile);
} else if (options.assignProperty) {
return callback(null, user, info);
}
if (options.successFlash && info) {
var option = options.successFlash;
if (typeof option == 'string') {
option = { type: 'success', message: option };
}
option.type = option.type || 'success';
var type = option.type || info.type || 'success';
var msg = option.message || info.message || info;
if (typeof msg == 'string') {
req.flash(type, msg);
}
}
if (options.assignProperty) {
req[options.assignProperty] = user;

@@ -90,4 +104,19 @@ return next();

if (callback) {
return callback(null, false);
} else if (options.failureRedirect) {
return callback(null, false, challenge, status);
}
if (options.failureFlash && challenge) {
var option = options.failureFlash;
if (typeof option == 'string') {
option = { type: 'error', message: option };
}
option.type = option.type || 'error';
var type = option.type || challenge.type || 'error';
var msg = option.message || challenge.message || challenge;
if (typeof msg == 'string') {
req.flash(type, msg);
}
}
if (options.failureRedirect) {
return res.redirect(options.failureRedirect);

@@ -107,3 +136,3 @@ }

res.statusCode = status || 401;
if (challenge) {
if (typeof challenge == 'string') {
this.res.setHeader('WWW-Authenticate', challenge);

@@ -110,0 +139,0 @@ }

{
"name": "passport",
"version": "0.1.6",
"version": "0.1.7",
"description": "Simple, unobtrusive authentication for Node.js.",

@@ -21,2 +21,5 @@ "author": { "name": "Jared Hanson", "email": "jaredhanson@gmail.com", "url": "http://www.jaredhanson.net/" },

},
"scripts": {
"test": "NODE_PATH=lib node_modules/.bin/vows test/*-test.js test/**/*-test.js test/context/http/*-test.js"
},
"engines": { "node": ">= 0.4.0" },

@@ -23,0 +26,0 @@ "licenses": [ {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc