probably re-enable friendlycaptcha on signin

This commit is contained in:
dakkar 2024-11-08 17:09:19 +00:00
parent 9980a2b9ff
commit 544fc3239f

View file

@ -28,6 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkCaptcha v-if="instance.enableMcaptcha" ref="mcaptcha" v-model="mCaptchaResponse" :class="$style.captcha" provider="mcaptcha" :sitekey="instance.mcaptchaSiteKey" :instanceUrl="instance.mcaptchaInstanceUrl"/> <MkCaptcha v-if="instance.enableMcaptcha" ref="mcaptcha" v-model="mCaptchaResponse" :class="$style.captcha" provider="mcaptcha" :sitekey="instance.mcaptchaSiteKey" :instanceUrl="instance.mcaptchaInstanceUrl"/>
<MkCaptcha v-if="instance.enableRecaptcha" ref="recaptcha" v-model="reCaptchaResponse" :class="$style.captcha" provider="recaptcha" :sitekey="instance.recaptchaSiteKey"/> <MkCaptcha v-if="instance.enableRecaptcha" ref="recaptcha" v-model="reCaptchaResponse" :class="$style.captcha" provider="recaptcha" :sitekey="instance.recaptchaSiteKey"/>
<MkCaptcha v-if="instance.enableTurnstile" ref="turnstile" v-model="turnstileResponse" :class="$style.captcha" provider="turnstile" :sitekey="instance.turnstileSiteKey"/> <MkCaptcha v-if="instance.enableTurnstile" ref="turnstile" v-model="turnstileResponse" :class="$style.captcha" provider="turnstile" :sitekey="instance.turnstileSiteKey"/>
<MkCaptcha v-if="instance.enableFC" ref="fc" v-model="fcResponse" :class="$style.captcha" provider="fc" :sitekey="instance.fcSiteKey"/>
<MkCaptcha v-if="instance.enableTestcaptcha" ref="testcaptcha" v-model="testcaptchaResponse" :class="$style.captcha" provider="testcaptcha"/> <MkCaptcha v-if="instance.enableTestcaptcha" ref="testcaptcha" v-model="testcaptchaResponse" :class="$style.captcha" provider="testcaptcha"/>
</div> </div>
@ -45,6 +46,7 @@ export type PwResponse = {
mCaptchaResponse: string | null; mCaptchaResponse: string | null;
reCaptchaResponse: string | null; reCaptchaResponse: string | null;
turnstileResponse: string | null; turnstileResponse: string | null;
fcResponse: string | null;
testcaptchaResponse: string | null; testcaptchaResponse: string | null;
}; };
}; };
@ -77,12 +79,14 @@ const hCaptcha = useTemplateRef('hcaptcha');
const mCaptcha = useTemplateRef('mcaptcha'); const mCaptcha = useTemplateRef('mcaptcha');
const reCaptcha = useTemplateRef('recaptcha'); const reCaptcha = useTemplateRef('recaptcha');
const turnstile = useTemplateRef('turnstile'); const turnstile = useTemplateRef('turnstile');
const fc = useTemplateRef('fc');
const testcaptcha = useTemplateRef('testcaptcha'); const testcaptcha = useTemplateRef('testcaptcha');
const hCaptchaResponse = ref<string | null>(null); const hCaptchaResponse = ref<string | null>(null);
const mCaptchaResponse = ref<string | null>(null); const mCaptchaResponse = ref<string | null>(null);
const reCaptchaResponse = ref<string | null>(null); const reCaptchaResponse = ref<string | null>(null);
const turnstileResponse = ref<string | null>(null); const turnstileResponse = ref<string | null>(null);
const fcResponse = ref<string | null>(null);
const testcaptchaResponse = ref<string | null>(null); const testcaptchaResponse = ref<string | null>(null);
const captchaFailed = computed((): boolean => { const captchaFailed = computed((): boolean => {
@ -91,6 +95,7 @@ const captchaFailed = computed((): boolean => {
(instance.enableMcaptcha && !mCaptchaResponse.value) || (instance.enableMcaptcha && !mCaptchaResponse.value) ||
(instance.enableRecaptcha && !reCaptchaResponse.value) || (instance.enableRecaptcha && !reCaptchaResponse.value) ||
(instance.enableTurnstile && !turnstileResponse.value) || (instance.enableTurnstile && !turnstileResponse.value) ||
(instance.enableFC && !fcResponse.value) ||
(instance.enableTestcaptcha && !testcaptchaResponse.value) (instance.enableTestcaptcha && !testcaptchaResponse.value)
); );
}); });
@ -109,6 +114,7 @@ function onSubmit() {
mCaptchaResponse: mCaptchaResponse.value, mCaptchaResponse: mCaptchaResponse.value,
reCaptchaResponse: reCaptchaResponse.value, reCaptchaResponse: reCaptchaResponse.value,
turnstileResponse: turnstileResponse.value, turnstileResponse: turnstileResponse.value,
fcResponse: fcResponse.value,
testcaptchaResponse: testcaptchaResponse.value, testcaptchaResponse: testcaptchaResponse.value,
}, },
}); });
@ -119,6 +125,7 @@ function resetCaptcha() {
mCaptcha.value?.reset(); mCaptcha.value?.reset();
reCaptcha.value?.reset(); reCaptcha.value?.reset();
turnstile.value?.reset(); turnstile.value?.reset();
fc.value?.reset();
testcaptcha.value?.reset(); testcaptcha.value?.reset();
} }