fix(api): 🐛 Automatically make all usernames lowercase

This commit is contained in:
Jesse Wierzbinski 2024-11-21 09:23:25 +01:00
parent 5dd8b872d9
commit a3b745358b
No known key found for this signature in database
3 changed files with 3 additions and 2 deletions

View file

@ -23,7 +23,7 @@ export const meta = applyConfig({
export const schemas = {
query: z.object({
username: z.string().min(1).max(512),
username: z.string().min(1).max(512).toLowerCase(),
}),
};

View file

@ -25,7 +25,7 @@ export const meta = applyConfig({
export const schemas = {
json: z.object({
username: z.string(),
username: z.string().toLowerCase(),
email: z.string().toLowerCase(),
password: z.string().optional(),
agreement: z

View file

@ -46,6 +46,7 @@ export const schemas = {
.min(3)
.trim()
.max(config.validation.max_username_size)
.toLowerCase()
.refine(
(s) =>
!config.filters.username.some((filter) => s.match(filter)),