summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-05-16 16:08:50 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-05-16 16:08:50 +0900
commit70d710c9a9199c4ab017de065ec6e69400afc22a (patch)
treec65be6b5e603ffcfd947e298d558e7e78f87c948 /src
parentNew Crowdin translations (#4924) (diff)
downloadsharkey-70d710c9a9199c4ab017de065ec6e69400afc22a.tar.gz
sharkey-70d710c9a9199c4ab017de065ec6e69400afc22a.tar.bz2
sharkey-70d710c9a9199c4ab017de065ec6e69400afc22a.zip
管理画面でreCAPTCHAのプレビューを表示するように
Diffstat (limited to 'src')
-rw-r--r--src/client/app/admin/views/instance.vue32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/client/app/admin/views/instance.vue b/src/client/app/admin/views/instance.vue
index 3ac4d6d721..72ae3384b5 100644
--- a/src/client/app/admin/views/instance.vue
+++ b/src/client/app/admin/views/instance.vue
@@ -165,6 +165,10 @@
</ui-horizon-group>
</template>
</section>
+ <section v-if="enableRecaptcha && recaptchaSiteKey">
+ <header>{{ $t('recaptcha-preview') }}</header>
+ <div ref="recaptcha" style="margin: 16px 0 0 0;" :key="recaptchaSiteKey"></div>
+ </section>
<section>
<ui-button @click="updateMeta"><fa :icon="faSave"/> {{ $t('save') }}</ui-button>
</section>
@@ -376,6 +380,34 @@ export default Vue.extend({
});
},
+ mounted() {
+ const renderRecaptchaPreview = () => {
+ if (!(window as any).grecaptcha) return;
+ if (!this.$refs.recaptcha) return;
+ if (!this.recaptchaSiteKey) return;
+ (window as any).grecaptcha.render(this.$refs.recaptcha, {
+ sitekey: this.recaptchaSiteKey
+ });
+ };
+
+ window.onRecaotchaLoad = () => {
+ renderRecaptchaPreview();
+ };
+
+ const head = document.getElementsByTagName('head')[0];
+ const script = document.createElement('script');
+ script.setAttribute('src', 'https://www.google.com/recaptcha/api.js?onload=onRecaotchaLoad');
+ head.appendChild(script);
+
+ this.$watch('enableRecaptcha', () => {
+ renderRecaptchaPreview();
+ });
+
+ this.$watch('recaptchaSiteKey', () => {
+ renderRecaptchaPreview();
+ });
+ },
+
methods: {
invite() {
this.$root.api('admin/invite').then(x => {