Disable login captcha if backend has no captcha secret (#5288)
* Add /_internal/globals route * Don't show login captcha if backend claims it's disabled * try to re-add tombi * typos * Assume captcha enabled if globals route is unreachable * Prepare frontend fixes
This commit is contained in:
@@ -108,11 +108,11 @@
|
||||
</IntlFormatted>
|
||||
</p>
|
||||
|
||||
<HCaptcha ref="captcha" v-model="token" />
|
||||
<HCaptcha v-if="globals?.captcha_enabled" ref="captcha" v-model="token" />
|
||||
|
||||
<button
|
||||
class="btn btn-primary continue-btn centered-btn"
|
||||
:disabled="!token"
|
||||
:disabled="globals?.captcha_enabled ? !token : false"
|
||||
@click="createAccount"
|
||||
>
|
||||
{{ formatMessage(messages.createAccountButton) }} <RightArrowIcon />
|
||||
@@ -209,6 +209,15 @@ if (auth.value.user) {
|
||||
|
||||
const captcha = ref()
|
||||
|
||||
const { data: globals } = await useAsyncData('auth-globals', async () => {
|
||||
try {
|
||||
return await useBaseFetch('globals', { internal: true })
|
||||
} catch (err) {
|
||||
console.error('Error fetching globals:', err)
|
||||
return { captcha_enabled: true }
|
||||
}
|
||||
})
|
||||
|
||||
const email = ref('')
|
||||
const username = ref('')
|
||||
const password = ref('')
|
||||
|
||||
Reference in New Issue
Block a user