mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-04 00:20:45 +00:00
fix: send right error codes (#2867)
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user