mirror of
https://github.com/versia-pub/server.git
synced 2025-12-07 00:48:18 +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 = {
|
export const schemas = {
|
||||||
query: z.object({
|
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 = {
|
export const schemas = {
|
||||||
json: z.object({
|
json: z.object({
|
||||||
username: z.string(),
|
username: z.string().toLowerCase(),
|
||||||
email: z.string().toLowerCase(),
|
email: z.string().toLowerCase(),
|
||||||
password: z.string().optional(),
|
password: z.string().optional(),
|
||||||
agreement: z
|
agreement: z
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ export const schemas = {
|
||||||
.min(3)
|
.min(3)
|
||||||
.trim()
|
.trim()
|
||||||
.max(config.validation.max_username_size)
|
.max(config.validation.max_username_size)
|
||||||
|
.toLowerCase()
|
||||||
.refine(
|
.refine(
|
||||||
(s) =>
|
(s) =>
|
||||||
!config.filters.username.some((filter) => s.match(filter)),
|
!config.filters.username.some((filter) => s.match(filter)),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue