mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-13 16:22:39 +10:00
feat(registration): require lowercase usernames
This commit is contained in:
@ -77,7 +77,7 @@
|
|||||||
'block text-xs font-medium leading-6',
|
'block text-xs font-medium leading-6',
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
Must be 5 or more characters
|
Must be 5 or more characters, and lowercase
|
||||||
</p>
|
</p>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<input
|
<input
|
||||||
@ -210,7 +210,11 @@ const confirmPassword = ref(undefined);
|
|||||||
|
|
||||||
const mailRegex = /^\S+@\S+\.\S+$/g;
|
const mailRegex = /^\S+@\S+\.\S+$/g;
|
||||||
const validEmail = computed(() => mailRegex.test(email.value ?? ""));
|
const validEmail = computed(() => mailRegex.test(email.value ?? ""));
|
||||||
const validUsername = computed(() => (username.value?.length ?? 0) > 5);
|
const validUsername = computed(
|
||||||
|
() =>
|
||||||
|
(username.value?.length ?? 0) > 5 &&
|
||||||
|
username.value?.toLowerCase() == username.value
|
||||||
|
);
|
||||||
const validPassword = computed(() => (password.value?.length ?? 0) >= 14);
|
const validPassword = computed(() => (password.value?.length ?? 0) >= 14);
|
||||||
const validConfirmPassword = computed(
|
const validConfirmPassword = computed(
|
||||||
() => password.value == confirmPassword.value
|
() => password.value == confirmPassword.value
|
||||||
|
|||||||
@ -54,6 +54,11 @@ export default defineEventHandler(async (h3) => {
|
|||||||
statusCode: 400,
|
statusCode: 400,
|
||||||
statusMessage: "Username is invalid. Must be more than 5 characters.",
|
statusMessage: "Username is invalid. Must be more than 5 characters.",
|
||||||
});
|
});
|
||||||
|
if (username.toLowerCase() != username)
|
||||||
|
throw createError({
|
||||||
|
statusCode: 400,
|
||||||
|
statusMessage: "Username must be all lowercase",
|
||||||
|
});
|
||||||
|
|
||||||
if (email === undefined)
|
if (email === undefined)
|
||||||
throw createError({
|
throw createError({
|
||||||
|
|||||||
Reference in New Issue
Block a user