mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
fix(api): 🐛 Automatically make all usernames lowercase
This commit is contained in:
parent
5dd8b872d9
commit
a3b745358b
|
|
@ -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(),
|
||||
}),
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)),
|
||||
|
|
|
|||
Loading…
Reference in a new issue