Fix status codes of 2fa routes

This commit is contained in:
Girish Ramakrishnan
2023-09-13 21:07:07 +05:30
parent 348eb16cef
commit 4997ad0468
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -156,7 +156,7 @@ async function setTwoFactorAuthenticationSecret(req, res, next) {
const [error, result] = await safe(users.setTwoFactorAuthenticationSecret(req.user.id, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(201, { secret: result.secret, qrcode: result.qrcode }));
next(new HttpSuccess(200, { secret: result.secret, qrcode: result.qrcode }));
}
async function enableTwoFactorAuthentication(req, res, next) {
@@ -168,7 +168,7 @@ async function enableTwoFactorAuthentication(req, res, next) {
const [error] = await safe(users.enableTwoFactorAuthentication(req.user.id, req.body.totpToken, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, {}));
next(new HttpSuccess(204, {}));
}
async function disableTwoFactorAuthentication(req, res, next) {
@@ -177,5 +177,5 @@ async function disableTwoFactorAuthentication(req, res, next) {
const [error] = await safe(users.disableTwoFactorAuthentication(req.user.id, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, {}));
next(new HttpSuccess(204, {}));
}