From a1b8b712ab724b2d4d7ffa9e5ecc5c77b1320ee9 Mon Sep 17 00:00:00 2001 From: Louis Laureys Date: Mon, 5 Oct 2020 19:36:08 +0200 Subject: [PATCH] Fix disable custom 2FA response --- lib/api/2fa/custom.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/api/2fa/custom.js b/lib/api/2fa/custom.js index 49214871..4e401f8b 100644 --- a/lib/api/2fa/custom.js +++ b/lib/api/2fa/custom.js @@ -166,19 +166,19 @@ module.exports = (db, server, userHandler) => { } let user = new ObjectID(result.value.user); - let { success, disabled2fa } = await userHandler.disableCustom2fa(user, result.value); + let disabled2fa = await userHandler.disableCustom2fa(user, result.value); - if (!success) { + if (!disabled2fa) { res.json({ - error: 'Failed to enable 2FA', - code: '2FAEnableFailed' + error: 'Failed to disable 2FA', + code: '2FADisableFailed' }); return next(); } if (disabled2fa && req.accessToken && typeof req.accessToken.update === 'function') { try { - // update access token data for current session after U2F enabled + // update access token data for current session after custom 2FA disabled await req.accessToken.update(); } catch (err) { // ignore @@ -186,7 +186,7 @@ module.exports = (db, server, userHandler) => { } res.json({ - success + success: true }); return next();