Fixup 2fa reset route
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user