This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Zaimki/components/Captcha.vue

37 lines
864 B
Vue
Raw Normal View History

2021-08-07 03:03:49 -07:00
<template>
<div class="h-captcha"
:data-theme="isDark ? 'dark' : 'light'"
:data-sitekey="siteKey"
data-callback="hCaptchaDone"
2021-08-07 04:47:03 -07:00
style="height: 73px"
2021-08-07 03:03:49 -07:00
></div>
</template>
<script>
import dark from "../plugins/dark";
export default {
mixins: [dark],
props: {
value: {},
},
data() {
return {
siteKey: process.env.HCAPTCHA_SITEKEY,
isDark: false,
};
},
mounted() {
if (!process.client) {
return false;
}
this.isDark = this.detectDark();
this.$loadScript('hcaptcha', 'https://js.hcaptcha.com/1/api.js');
window.hCaptchaDone = (token) => {
this.$emit('input', token);
}
},
}
</script>