summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-11-07 00:08:21 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-11-07 00:08:21 +0900
commita6f8327aa263022ed5d079f8e413bb17480feb7b (patch)
treee0f75658f50da107627b838b10832764e71c192c /src/client
parent10.42.2 (diff)
downloadsharkey-a6f8327aa263022ed5d079f8e413bb17480feb7b.tar.gz
sharkey-a6f8327aa263022ed5d079f8e413bb17480feb7b.tar.bz2
sharkey-a6f8327aa263022ed5d079f8e413bb17480feb7b.zip
reCAPTCHAの設定をDBに保存するように
Diffstat (limited to 'src/client')
-rw-r--r--src/client/app/admin/views/instance.vue18
-rw-r--r--src/client/app/common/views/components/signup.vue6
2 files changed, 20 insertions, 4 deletions
diff --git a/src/client/app/admin/views/instance.vue b/src/client/app/admin/views/instance.vue
index 050fb6617d..47ab9e6159 100644
--- a/src/client/app/admin/views/instance.vue
+++ b/src/client/app/admin/views/instance.vue
@@ -16,6 +16,13 @@
<ui-input v-model="localDriveCapacityMb">%i18n:@local-drive-capacity-mb%<span slot="desc">%i18n:@mb%</span><span slot="suffix">MB</span></ui-input>
<ui-input v-model="remoteDriveCapacityMb" :disabled="!cacheRemoteFiles">%i18n:@remote-drive-capacity-mb%<span slot="desc">%i18n:@mb%</span><span slot="suffix">MB</span></ui-input>
</section>
+ <section class="fit-bottom">
+ <header><fa icon="shield-alt"/> %i18n:@recaptcha-config%</header>
+ <ui-switch v-model="enableRecaptcha">%i18n:@enable-recaptcha%</ui-switch>
+ <ui-info>%i18n:@recaptcha-info%</ui-info>
+ <ui-input v-model="recaptchaSiteKey" :disabled="!enableRecaptcha"><i slot="icon"><fa icon="key"/></i>%i18n:@recaptcha-site-key%</ui-input>
+ <ui-input v-model="recaptchaSecretKey" :disabled="!enableRecaptcha"><i slot="icon"><fa icon="key"/></i>%i18n:@recaptcha-secret-key%</ui-input>
+ </section>
<section>
<ui-button @click="updateMeta">%i18n:@save%</ui-button>
</section>
@@ -54,6 +61,9 @@ export default Vue.extend({
localDriveCapacityMb: null,
remoteDriveCapacityMb: null,
maxNoteTextLength: null,
+ enableRecaptcha: false,
+ recaptchaSiteKey: null,
+ recaptchaSecretKey: null,
inviteCode: null,
};
},
@@ -67,6 +77,9 @@ export default Vue.extend({
this.localDriveCapacityMb = meta.driveCapacityPerLocalUserMb;
this.remoteDriveCapacityMb = meta.driveCapacityPerRemoteUserMb;
this.maxNoteTextLength = meta.maxNoteTextLength;
+ this.enableRecaptcha = meta.enableRecaptcha;
+ this.recaptchaSiteKey = meta.recaptchaSiteKey;
+ this.recaptchaSecretKey = meta.recaptchaSecretKey;
});
},
@@ -92,7 +105,10 @@ export default Vue.extend({
cacheRemoteFiles: this.cacheRemoteFiles,
localDriveCapacityMb: parseInt(this.localDriveCapacityMb, 10),
remoteDriveCapacityMb: parseInt(this.remoteDriveCapacityMb, 10),
- maxNoteTextLength: parseInt(this.maxNoteTextLength, 10)
+ maxNoteTextLength: parseInt(this.maxNoteTextLength, 10),
+ enableRecaptcha: this.enableRecaptcha,
+ recaptchaSiteKey: this.recaptchaSiteKey,
+ recaptchaSecretKey: this.recaptchaSecretKey
}).then(() => {
this.$swal({
type: 'success',
diff --git a/src/client/app/common/views/components/signup.vue b/src/client/app/common/views/components/signup.vue
index fa26eabc91..91a09e14fb 100644
--- a/src/client/app/common/views/components/signup.vue
+++ b/src/client/app/common/views/components/signup.vue
@@ -35,7 +35,7 @@
<p v-if="passwordRetypeState == 'not-match'" style="color:#FF1161"><fa icon="exclamation-triangle" fixed-width/> %i18n:@password-not-matched%</p>
</div>
</ui-input>
- <div v-if="meta.recaptchaSitekey != null" class="g-recaptcha" :data-sitekey="meta.recaptchaSitekey" style="margin: 16px 0;"></div>
+ <div v-if="meta.recaptchaSiteKey != null" class="g-recaptcha" :data-sitekey="meta.recaptchaSiteKey" style="margin: 16px 0;"></div>
<ui-button type="submit">%i18n:@create%</ui-button>
</template>
</form>
@@ -130,7 +130,7 @@ export default Vue.extend({
username: this.username,
password: this.password,
invitationCode: this.invitationCode,
- 'g-recaptcha-response': this.meta.recaptchaSitekey != null ? (window as any).grecaptcha.getResponse() : null
+ 'g-recaptcha-response': this.meta.recaptchaSiteKey != null ? (window as any).grecaptcha.getResponse() : null
}, true).then(() => {
(this as any).api('signin', {
username: this.username,
@@ -141,7 +141,7 @@ export default Vue.extend({
}).catch(() => {
alert('%i18n:@some-error%');
- if (this.meta.recaptchaSitekey != null) {
+ if (this.meta.recaptchaSiteKey != null) {
(window as any).grecaptcha.reset();
}
});