chore(errors): change password error naming and add additional errors

This commit is contained in:
William Oldham
2026-08-29 17:39:06 +01:00
parent dd3c084518
commit f60a60618a
2 changed files with 15 additions and 9 deletions

View File

@@ -21,11 +21,11 @@ const errors: Record<string, ApiErrorCodes> = {
'INVALID_ARGUMENT: Two or more punctuation characters cannot be used in a row': 'USERNAME_INVALID_CHARS',
'INVALID_ARGUMENT: PNID already in use': 'USERNAME_IN_USE',
'INVALID_ARGUMENT: Mii name too long': 'MIINAME_TOO_LONG',
'INVALID_ARGUMENT: Password must be between 6 and 16 characters long': 'INVALID_PASSWORD_INPUT',
'INVALID_ARGUMENT: Password cannot be the same as username': 'INVALID_PASSWORD_INPUT',
'INVALID_ARGUMENT: Password must have combination of letters, numbers, and/or punctuation characters': 'INVALID_PASSWORD_INPUT',
'INVALID_ARGUMENT: Password may not have 3 repeating characters': 'INVALID_PASSWORD_INPUT',
'INVALID_ARGUMENT: Passwords do not match': 'INVALID_PASSWORD_NO_MATCH'
'INVALID_ARGUMENT: Password must be between 6 and 16 characters long': 'PASSWORD_INVALID_LENGTH',
'INVALID_ARGUMENT: Password cannot be the same as username': 'PASSWORD_NOT_USERNAME',
'INVALID_ARGUMENT: Password must have combination of letters, numbers, and/or punctuation characters': 'PASSWORD_NEEDS_CHARS',
'INVALID_ARGUMENT: Password may not have 3 repeating characters': 'PASSWORD_REPEATED_CHARS',
'INVALID_ARGUMENT: Passwords do not match': 'PASSWORDS_DO_NOT_MATCH'
};
function getCutoffDateForAge(today: Date, age: number) {

View File

@@ -16,8 +16,11 @@ const apiErrorCodes = {
USERNAME_INVALID_CHARS: 'Username contains invalid characters',
USERNAME_IN_USE: 'PNID already in use',
MIINAME_TOO_LONG: 'Mii name too long',
INVALID_PASSWORD_INPUT: 'Password must be between 6 and 16 characters long',
INVALID_PASSWORD_NO_MATCH: 'Passwords do not match',
PASSWORD_INVALID_LENGTH: 'Password must be between 6 and 16 characters long',
PASSWORD_NOT_USERNAME: 'Password cannot be the same as your username',
PASSWORD_NEEDS_CHARS: 'Password must have combination of letters, numbers, and/or punctuation characters',
PASSWORDS_DO_NOT_MATCH: 'Passwords do not match',
PASSWORD_REPEATED_CHARS: 'Password may not have 3 repeating characters',
ACCOUNT_DELETED: 'Account has been deleted',
INVALID_ACCESS_LEVEL: 'Invalid access level',
BANNED: 'Account is banned',
@@ -45,8 +48,11 @@ export const apiErrorCodeStatus: Record<ApiErrorCodes, number> = {
UNDER_THIRTEEN: 400,
ACCOUNT_DELETED: 400,
INVALID_EMAIL: 400,
INVALID_PASSWORD_INPUT: 400,
INVALID_PASSWORD_NO_MATCH: 400,
PASSWORD_INVALID_LENGTH: 400,
PASSWORD_NOT_USERNAME: 400,
PASSWORD_NEEDS_CHARS: 400,
PASSWORDS_DO_NOT_MATCH: 400,
PASSWORD_REPEATED_CHARS: 400,
MIINAME_TOO_LONG: 400,
USERNAME_IN_USE: 400,
USERNAME_INVALID_CHARS: 400,