Skip to content

Commit

Permalink
fix(v3): update error code for invalid invitation code
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao committed Nov 29, 2024
1 parent 20d507e commit 0a82440
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/v3/controllers/pockets_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ export const validateInvitation = async (req: Request, res: Response) => {
res.locals.type = 'warn';
res.locals.message = `invalid input: ${msg}`;

res.status(400).json({
message: 'error_api_bad-request',
});
res.status(400).json({ message: 'error_api_bad-request' });

return;
}
Expand All @@ -41,7 +39,7 @@ export const validateInvitation = async (req: Request, res: Response) => {
if (groups === null) {
res.locals.type = 'warn';
res.locals.message = 'the code received is invalid';
res.status(400).json({ message: 'INVALID_CODE' });
res.status(400).json({ message: 'error_app_security_invalid-invitation-code' });
return;
}

Expand All @@ -57,7 +55,7 @@ export const validateInvitation = async (req: Request, res: Response) => {
if (groups === null) {
res.locals.type = 'warn';
res.locals.message = 'the code received is invalid';
res.status(400).json({ message: 'INVALID_CODE' });
res.status(400).json({ message: 'error_app_security_invalid-invitation-code' });
return;
}

Expand All @@ -71,7 +69,7 @@ export const validateInvitation = async (req: Request, res: Response) => {
if (!cong) {
res.locals.type = 'warn';
res.locals.message = 'no congregation could not be found with the provided code';
res.status(400).json({ message: 'INVALID_CODE' });
res.status(400).json({ message: 'error_app_security_invalid-invitation-code' });
return;
}

Expand All @@ -82,7 +80,7 @@ export const validateInvitation = async (req: Request, res: Response) => {
if (!decryptedAccessCode) {
res.locals.type = 'warn';
res.locals.message = 'the code received is invalid';
res.status(400).json({ message: 'INVALID_CODE' });
res.status(400).json({ message: 'error_app_security_invalid-invitation-code' });
return;
}

Expand All @@ -93,7 +91,7 @@ export const validateInvitation = async (req: Request, res: Response) => {
if (!user) {
res.locals.type = 'warn';
res.locals.message = 'the code received is invalid';
res.status(400).json({ message: 'INVALID_CODE' });
res.status(400).json({ message: 'error_app_security_invalid-invitation-code' });
return;
}

Expand Down

0 comments on commit 0a82440

Please sign in to comment.