Fixup 2fa reset route

This commit is contained in:
Johannes Zellner
2021-09-16 13:18:22 +02:00
parent df864a8b6e
commit ecd35bd08d

View File

@@ -151,16 +151,15 @@ async function createInvite(req, res, next) {
next(new HttpSuccess(200, result));
}
function disableTwoFactorAuthentication(req, res, next) {
async function disableTwoFactorAuthentication(req, res, next) {
assert.strictEqual(typeof req.resource, 'object');
if (users.compareRoles(req.user.role, req.resource.role) < 0) return next(new HttpError(403, `role '${req.resource.role}' is required but user has only '${req.user.role}'`));
users.disableTwoFactorAuthentication(req.resource.id, function (error, result) {
if (error) return next(BoxError.toHttpError(error));
const [error] = await safe(users.disableTwoFactorAuthentication(req.resource.id, auditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, result));
});
next(new HttpSuccess(200, {}));
}
async function sendInvite(req, res, next) {