From 0e53edafa37dc851d26bb6481324256676a1a859 Mon Sep 17 00:00:00 2001 From: Daniel Salazar Date: Thu, 30 Apr 2026 21:42:48 -0700 Subject: [PATCH] fix: send right error codes (#2867) Co-authored-by: Copilot --- src/backend/controllers/auth/AuthController.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/backend/controllers/auth/AuthController.js b/src/backend/controllers/auth/AuthController.js index 8066e7a47..6a4617716 100644 --- a/src/backend/controllers/auth/AuthController.js +++ b/src/backend/controllers/auth/AuthController.js @@ -405,6 +405,7 @@ export class AuthController extends PuterController { 403, validateEvent.message ?? 'Temporary accounts are disabled', + { legacyCode: 'must_login_or_signup' }, ); } const force_email_confirmation = Boolean( @@ -660,9 +661,14 @@ export class AuthController extends PuterController { const user = await this.stores.user.getById(req.actor.user.id, { force: true, }); - if (!user) throw new HttpError(404, 'User not found.'); + if (!user) + throw new HttpError(404, 'User not found.', { + legacyCode: 'user_not_found', + }); if (user.suspended) - throw new HttpError(403, 'Account suspended.'); + throw new HttpError(403, 'Account suspended.', { + legacyCode: 'account_suspended', + }); if (!user.email) throw new HttpError(400, 'No email on file.'); const code = String(crypto.randomInt(100000, 1000000));