Directly use users.verify() instead of another db lookup

This commit is contained in:
Johannes Zellner
2021-09-09 22:50:35 +02:00
parent 2d5eb6fd62
commit d3d22f0878

View File

@@ -132,7 +132,7 @@ async function verifyPassword(req, res, next) {
if (typeof req.body.password !== 'string') return next(new HttpError(400, 'API call requires user password'));
const [error] = await safe(users.verifyWithUsername(req.user.username, req.body.password, users.AP_WEBADMIN));
const [error] = await safe(users.verify(req.user.id, req.body.password, users.AP_WEBADMIN));
if (error) return next(BoxError.toHttpError(error));
req.body.password = '<redacted>'; // this will prevent logs from displaying plain text password