Skip to content

Commit

Permalink
Register page captcha enable if captcha key set
Browse files Browse the repository at this point in the history
  • Loading branch information
chiragchhatrala committed Dec 12, 2024
1 parent ca3c560 commit 9260b4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function validator(array $data)
'utm_data' => ['nullable', 'array'],
];

if (!config('app.self_hosted')) {
if (config('services.h_captcha.secret_key')) {
$rules['h-captcha-response'] = [new ValidHCaptcha()];
}

Expand Down
9 changes: 4 additions & 5 deletions client/components/pages/auth/components/RegisterForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<!-- hCaptcha -->
<div
v-if="!isSelfHosted"
v-if="hCaptchaSiteKey"
class="mb-3 px-2 mt-2 mx-auto w-max"
>
<vue-hcaptcha
Expand Down Expand Up @@ -180,8 +180,7 @@ export default {
'h-captcha-response': null
}),
disableEmail: false,
hcaptcha: null,
isSelfHosted: useFeatureFlag('self_hosted')
hcaptcha: null
}),
computed: {
Expand Down Expand Up @@ -210,7 +209,7 @@ export default {
},
mounted() {
if (!this.isSelfHosted) {
if (this.hCaptchaSiteKey) {
this.hcaptcha = this.$refs.hcaptcha
}
Expand All @@ -235,7 +234,7 @@ export default {
async register() {
let data
this.form.utm_data = this.$utm.value
if (!this.isSelfHosted) {
if (this.hCaptchaSiteKey) {
this.form['h-captcha-response'] = document.getElementsByName('h-captcha-response')[0].value
this.hcaptcha.reset()
}
Expand Down

0 comments on commit 9260b4b

Please sign in to comment.