diff --git a/frontend/composables/use-users/user-registration-form.ts b/frontend/composables/use-users/user-registration-form.ts index f61b26d56..be24ffd84 100644 --- a/frontend/composables/use-users/user-registration-form.ts +++ b/frontend/composables/use-users/user-registration-form.ts @@ -1,5 +1,5 @@ import { useAsyncValidator } from "~/composables/use-validators"; -import type { VForm } from "~/types/vuetify"; +import type { VForm } from "~/types/auto-forms"; import { usePublicApi } from "~/composables/api/api-client"; const domAccountForm = ref(null); @@ -13,11 +13,13 @@ const advancedOptions = ref(false); export const useUserRegistrationForm = () => { const i18n = useI18n(); - function safeValidate(form: Ref) { - if (form.value && form.value.validate) { - return form.value.validate(); + async function safeValidate(form: Ref) { + if (!form.value) { + return false; } - return false; + + const result = await form.value.validate(); + return result.valid; } // ================================================================ // Provide Group Details @@ -45,11 +47,15 @@ export const useUserRegistrationForm = () => { email, advancedOptions, validate: async () => { - if (!(validUsername.value && validEmail.value)) { + if (!validUsername.value || !validEmail.value) { await Promise.all([validateUsername(), validateEmail()]); } - return (safeValidate(domAccountForm as Ref) && validUsername.value && validEmail.value); + if (!validUsername.value || !validEmail.value) { + return false; + } + + return await safeValidate(domAccountForm as Ref); }, reset: () => { accountDetails.username.value = "";