koa-basic-auth
Advanced tools
Comparing version 1.1.2 to 2.0.0
14
index.js
'use strict'; | ||
/** | ||
@@ -6,4 +8,4 @@ * Module dependencies. | ||
var auth = require('basic-auth'); | ||
var assert = require('assert'); | ||
const auth = require('basic-auth'); | ||
const assert = require('assert'); | ||
@@ -28,11 +30,11 @@ /** | ||
return function *basicAuth(next){ | ||
var user = auth(this); | ||
return function basicAuth(ctx, next){ | ||
const user = auth(ctx); | ||
if (user && user.name == opts.name && user.pass == opts.pass) { | ||
yield next; | ||
return next(); | ||
} else { | ||
this.throw(401); | ||
ctx.throw(401); | ||
} | ||
}; | ||
}; |
@@ -5,7 +5,7 @@ { | ||
"repository": "koajs/basic-auth", | ||
"version": "1.1.2", | ||
"version": "2.0.0", | ||
"scripts": { | ||
"test": "NODE_ENV=test mocha --harmony-generators --reporter spec", | ||
"test-cov": "NODE_ENV=test node --harmony-generators ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha", | ||
"test-travis": "NODE_ENV=test node --harmony-generators ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly" | ||
"test": "NODE_ENV=test mocha --reporter spec", | ||
"test-cov": "NODE_ENV=test istanbul cover ./node_modules/.bin/_mocha", | ||
"test-travis": "NODE_ENV=test istanbul cover ./node_modules/.bin/_mocha --report lcovonly" | ||
}, | ||
@@ -23,11 +23,11 @@ "keywords": [ | ||
"devDependencies": { | ||
"istanbul-harmony": "0", | ||
"koa": "*", | ||
"mocha": "^1.12.0", | ||
"supertest": "0" | ||
"istanbul": "0", | ||
"koa": "^2.0.0-alpha.3", | ||
"mocha": "2", | ||
"supertest": "1" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"basic-auth": "^1.0.0" | ||
"basic-auth": "^1.0.3" | ||
} | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
3178
4
30
Updatedbasic-auth@^1.0.3