koa-auth-basic
Advanced tools
Comparing version 1.0.0 to 1.1.0
11
index.js
@@ -28,8 +28,11 @@ 'use strict' | ||
if (credentials && checkCredentials(credentials.name, credentials.pass)) { | ||
await next() | ||
} else { | ||
ctx.throw(401) | ||
if (credentials) { | ||
const valid = await Promise.resolve(checkCredentials(credentials.name, credentials.pass)) | ||
if (valid) { | ||
await next() | ||
return | ||
} | ||
} | ||
ctx.throw(401) | ||
} | ||
} |
{ | ||
"name": "koa-auth-basic", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Koa basic auth middleware with custom credential check", | ||
@@ -13,3 +13,4 @@ "repository": "kbrgl/koa-auth-basic", | ||
"basicauth", | ||
"basic auth" | ||
"basic auth", | ||
"middleware" | ||
], | ||
@@ -16,0 +17,0 @@ "files": [ |
2931
29