diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-05-16 16:14:00 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-05-16 16:14:00 +0900 |
| commit | 5ce412aedaa5f1c9696fb2feabd4dd65408da318 (patch) | |
| tree | 5f3ebb25f45af486c87b39b83525c47c57eeb1cc /src/client/app | |
| parent | Merge branch 'develop' (diff) | |
| parent | 11.15.0 (diff) | |
| download | misskey-5ce412aedaa5f1c9696fb2feabd4dd65408da318.tar.gz misskey-5ce412aedaa5f1c9696fb2feabd4dd65408da318.tar.bz2 misskey-5ce412aedaa5f1c9696fb2feabd4dd65408da318.zip | |
Merge branch 'develop'
Diffstat (limited to 'src/client/app')
| -rw-r--r-- | src/client/app/admin/views/instance.vue | 32 |
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 => { |