diff --git a/components/recaptcha.vue b/components/recaptcha.vue new file mode 100644 index 0000000..008d9e6 --- /dev/null +++ b/components/recaptcha.vue @@ -0,0 +1,33 @@ + + + + + diff --git a/pages/auth/register.vue b/pages/auth/register.vue index 284fdfc..c3602f2 100644 --- a/pages/auth/register.vue +++ b/pages/auth/register.vue @@ -6,6 +6,7 @@ import { useChallengeV2 } from "vue-recaptcha"; import { notification } from "ant-design-vue"; import termsOfServices from "~/components/tos.vue"; + import Recaptcha from "~/components/recaptcha.vue"; useRecaptchaProvider(); interface FormState { @@ -38,31 +39,14 @@ const dark = inject("dark"); - const { setValues, values, handleSubmit } = useForm({ + const { setValues, values, handleSubmit, setFieldValue } = useForm({ validationSchema: vschema, keepValuesOnUnmount: true, }); - const { - value: recaptchaValue, - errorMessage: recaptchaError, - name: recapName, - setValue: srv, - } = useField("recaptcha", undefined, { syncVModel: true }); - - const { root, execute, onVerify, widgetID } = useChallengeV2({ - options: { - size: "invisible", - }, - }); - onVerify((resp) => { - console.debug("onverify called", resp); - srv(resp); - }); const onFinish = handleSubmit(async (values: any, actions: any) => { // log.debug(values, widgetID); // log.debug(widgetID); - execute(); const { signUp } = useAuth(); let reso; try { @@ -75,22 +59,8 @@ }); } } - // log.debug(reso); - - /* try { -{data: reso } = await useApiFetch("/auth/register", { -method: "post", -body: values -}) -} catch (e: any) { -// log.debug(reso.error.data) -if (e.data) { -notification[ "error" ]({ - message: h("div", { innerHTML: reso.error.data.message }) -}) -} -} */ }); + const ts = ref(Date.now());