mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-13 00:02:37 +10:00
feat(registration): require lowercase usernames
This commit is contained in:
@ -77,7 +77,7 @@
|
||||
'block text-xs font-medium leading-6',
|
||||
]"
|
||||
>
|
||||
Must be 5 or more characters
|
||||
Must be 5 or more characters, and lowercase
|
||||
</p>
|
||||
<div class="mt-2">
|
||||
<input
|
||||
@ -210,7 +210,11 @@ const confirmPassword = ref(undefined);
|
||||
|
||||
const mailRegex = /^\S+@\S+\.\S+$/g;
|
||||
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 validConfirmPassword = computed(
|
||||
() => password.value == confirmPassword.value
|
||||
|
||||
@ -54,6 +54,11 @@ export default defineEventHandler(async (h3) => {
|
||||
statusCode: 400,
|
||||
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)
|
||||
throw createError({
|
||||
|
||||
Reference in New Issue
Block a user