abler-api 0.1.49 → 0.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/pp-util.js +6 -4
- package/package.json +1 -1
package/dist/cjs/pp-util.js
CHANGED
|
@@ -1426,17 +1426,19 @@ class apiUtil$2 {
|
|
|
1426
1426
|
throw {
|
|
1427
1427
|
status: 401,
|
|
1428
1428
|
error: {
|
|
1429
|
-
|
|
1429
|
+
success: false,
|
|
1430
|
+
stateCode: 40101,
|
|
1430
1431
|
message: 'need username and password'
|
|
1431
1432
|
}
|
|
1432
1433
|
};
|
|
1433
1434
|
}
|
|
1434
1435
|
|
|
1435
|
-
if (!(await apiUtil$2._validateBasicAuth(authorization.name, authorization.pass))) {
|
|
1436
|
+
if (!(await apiUtil$2._validateBasicAuth(authorization.name, authorization.pass, req, res, next))) {
|
|
1436
1437
|
throw {
|
|
1437
1438
|
status: 401,
|
|
1438
1439
|
error: {
|
|
1439
|
-
|
|
1440
|
+
success: false,
|
|
1441
|
+
stateCode: 40102,
|
|
1440
1442
|
message: 'invalid username or password'
|
|
1441
1443
|
}
|
|
1442
1444
|
};
|
|
@@ -1450,7 +1452,7 @@ class apiUtil$2 {
|
|
|
1450
1452
|
res.set('WWW-Authenticate', `Basic realm=validate fail`);
|
|
1451
1453
|
}
|
|
1452
1454
|
|
|
1453
|
-
return res.status(e.status || 500).send(e);
|
|
1455
|
+
return res.status(e.status || 500).send(e.error || e);
|
|
1454
1456
|
}
|
|
1455
1457
|
|
|
1456
1458
|
return next();
|