fix: captcha ref not defined
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, useTemplateRef } from 'vue';
|
||||||
import CAPTCHA from '../CAPTCHA.vue';
|
import CAPTCHA from '../CAPTCHA.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['new-message']);
|
const emit = defineEmits(['new-message']);
|
||||||
@@ -7,7 +7,7 @@ const props = defineProps(['locked']);
|
|||||||
|
|
||||||
const text = ref('');
|
const text = ref('');
|
||||||
|
|
||||||
const captcha = ref(null);
|
const captcha = useTemplateRef('captcha');
|
||||||
const captchaResponse = ref(null);
|
const captchaResponse = ref(null);
|
||||||
const captchaVerified = computed(() => {
|
const captchaVerified = computed(() => {
|
||||||
return captchaResponse.value !== null;
|
return captchaResponse.value !== null;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch, computed } from 'vue';
|
import { ref, watch, computed, useTemplateRef } from 'vue';
|
||||||
import CAPTCHA from '../CAPTCHA.vue';
|
import CAPTCHA from '../CAPTCHA.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['login-submit']);
|
const emit = defineEmits(['login-submit']);
|
||||||
@@ -7,6 +7,7 @@ const emit = defineEmits(['login-submit']);
|
|||||||
const username = ref('');
|
const username = ref('');
|
||||||
const password = ref('');
|
const password = ref('');
|
||||||
|
|
||||||
|
const captcha = useTemplateRef('captcha');
|
||||||
const captchaResponse = ref(null);
|
const captchaResponse = ref(null);
|
||||||
const captchaVerified = computed(() => {
|
const captchaVerified = computed(() => {
|
||||||
return captchaResponse.value !== null;
|
return captchaResponse.value !== null;
|
||||||
@@ -91,6 +92,7 @@ const submit = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<CAPTCHA
|
<CAPTCHA
|
||||||
|
ref="captcha"
|
||||||
:hcaptchaSitekey="$hcaptchaSitekey"
|
:hcaptchaSitekey="$hcaptchaSitekey"
|
||||||
:recaptchaSitekey="$recaptchaSitekey"
|
:recaptchaSitekey="$recaptchaSitekey"
|
||||||
:turnstileSitekey="$turnstileSitekey"
|
:turnstileSitekey="$turnstileSitekey"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, defineProps } from 'vue';
|
import { ref, computed, defineProps, useTemplateRef } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { uploadAvatar } from '../../lib/api';
|
import { uploadAvatar } from '../../lib/api';
|
||||||
import CAPTCHA from '../CAPTCHA.vue';
|
import CAPTCHA from '../CAPTCHA.vue';
|
||||||
@@ -17,6 +17,8 @@ const router = useRouter();
|
|||||||
|
|
||||||
const avatarFile = ref(null);
|
const avatarFile = ref(null);
|
||||||
const avatarError = ref('');
|
const avatarError = ref('');
|
||||||
|
|
||||||
|
const captcha = useTemplateRef('captcha');
|
||||||
const captchaResponse = ref(null);
|
const captchaResponse = ref(null);
|
||||||
|
|
||||||
const onFileChange = (event) => {
|
const onFileChange = (event) => {
|
||||||
@@ -101,6 +103,7 @@ const avatarUrl = computed(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<CAPTCHA
|
<CAPTCHA
|
||||||
|
ref="captcha"
|
||||||
:hcaptchaSitekey="$hcaptchaSitekey"
|
:hcaptchaSitekey="$hcaptchaSitekey"
|
||||||
:recaptchaSitekey="$recaptchaSitekey"
|
:recaptchaSitekey="$recaptchaSitekey"
|
||||||
:turnstileSitekey="$turnstileSitekey"
|
:turnstileSitekey="$turnstileSitekey"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch, computed } from 'vue';
|
import { ref, watch, computed, useTemplateRef } from 'vue';
|
||||||
import CAPTCHA from '../CAPTCHA.vue';
|
import CAPTCHA from '../CAPTCHA.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['new-user']);
|
const emit = defineEmits(['new-user']);
|
||||||
@@ -11,6 +11,7 @@ const captchaResponse = ref(null);
|
|||||||
const usernameError = ref('');
|
const usernameError = ref('');
|
||||||
const passwordError = ref('');
|
const passwordError = ref('');
|
||||||
|
|
||||||
|
const captcha = useTemplateRef('captcha');
|
||||||
const captchaVerified = computed(() => {
|
const captchaVerified = computed(() => {
|
||||||
return captchaResponse.value !== null;
|
return captchaResponse.value !== null;
|
||||||
});
|
});
|
||||||
@@ -62,6 +63,7 @@ const submit = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit('new-user', { username: username.value, password: password.value, captchaResponse: captchaResponse.value });
|
emit('new-user', { username: username.value, password: password.value, captchaResponse: captchaResponse.value });
|
||||||
|
captcha.value.reset();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref, useTemplateRef } from 'vue';
|
||||||
import { generateMotto as generateMottoApi } from '../lib/api';
|
import { generateMotto as generateMottoApi } from '../lib/api';
|
||||||
import { useAuthStore } from '../stores/auth';
|
import { useAuthStore } from '../stores/auth';
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ const mottoLoading = ref(false);
|
|||||||
|
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
|
|
||||||
const captcha = ref(null);
|
const captcha = useTemplateRef('captcha');
|
||||||
const captchaResponse = ref(null);
|
const captchaResponse = ref(null);
|
||||||
const captchaVerified = computed(() => {
|
const captchaVerified = computed(() => {
|
||||||
return captchaResponse.value !== null;
|
return captchaResponse.value !== null;
|
||||||
|
|||||||
Reference in New Issue
Block a user