Comparing version 1.2.1 to 1.2.2
@@ -29,3 +29,3 @@ | ||
exports.version = '1.2.1'; | ||
exports.version = '1.2.2'; | ||
@@ -32,0 +32,0 @@ /** |
@@ -21,6 +21,9 @@ | ||
* method is provided as well, invoking `callback(user, pass, callback)`. Populates | ||
* `req.remoteUser`. | ||
* `req.remoteUser`. The final alternative is simply passing username / password | ||
* strings. | ||
* | ||
* Examples: | ||
* | ||
* connect(connect.basicAuth('username', 'password')); | ||
* | ||
* connect( | ||
@@ -38,3 +41,3 @@ * connect.basicAuth(function(user, pass){ | ||
* | ||
* @param {Function} callback | ||
* @param {Function|String} callback or username | ||
* @param {String} realm | ||
@@ -45,2 +48,14 @@ * @api public | ||
module.exports = function basicAuth(callback, realm) { | ||
var username, password; | ||
// user / pass strings | ||
if ('string' == typeof callback) { | ||
username = callback; | ||
password = realm; | ||
if ('string' != typeof password) throw new Error('password argument required'); | ||
callback = function(user, pass){ | ||
return user == username && pass == password; | ||
} | ||
} | ||
realm = realm || 'Authorization Required'; | ||
@@ -47,0 +62,0 @@ |
@@ -47,3 +47,3 @@ | ||
module.exports = function errorHandler(options){ | ||
exports = module.exports = function errorHandler(options){ | ||
options = options || {}; | ||
@@ -72,2 +72,3 @@ | ||
.replace('{stack}', stack) | ||
.replace('{title}', exports.title) | ||
.replace(/\{error\}/g, err.toString()); | ||
@@ -97,1 +98,7 @@ res.setHeader('Content-Type', 'text/html'); | ||
}; | ||
/** | ||
* Template title. | ||
*/ | ||
exports.title = 'Connect'; |
{ | ||
"name": "connect", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "High performance middleware framework", | ||
@@ -5,0 +5,0 @@ "keywords": ["framework", "web", "middleware", "connect", "rack"], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77989
2823