Skip to content

Commit

Permalink
fix: optional captcha controlled by ENABLE_CAPTCHA env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
n13 committed Sep 29, 2024
1 parent bb3aec5 commit e14b54c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ module.exports = function (ctx) {
CAPTCHA_PUBLIC_KEY: process.env.CAPTCHA_PUBLIC_KEY,
CAPTCHA_HOST: process.env.CAPTCHA_HOST,
CAPTCHA_NETWORK: process.env.CAPTCHA_NETWORK || 'telosTestnet',
ENABLE_CAPTCHA: process.env.ENABLE_CAPTCHA !== undefined ? process.env.ENABLE_CAPTCHA === 'true' : true,
LOGIN_CONTRACT: process.env.LOGIN_CONTRACT,
JOIN_CONTRACT: process.env.JOIN_CONTRACT,
JOIN_URI: process.env.JOIN_URI,
Expand Down
15 changes: 10 additions & 5 deletions src/components/form/captcha.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,27 @@ VueReCaptcha(:sitekey="this.sitekey" :loadRecaptchaScript="true" @verify="verify

<script>
import VueReCaptcha from 'vue-recaptcha'
// import CaptchaService from '../../services/captcha'
import CaptchaService from '../../services/captcha'
export default {
name: 'captcha',
components: { VueReCaptcha },
data() {
const sitekey = process.env.CAPTCHA_PUBLIC_KEY
return {
sitekey
sitekey,
enableCaptcha: process.env.ENABLE_CAPTCHA
}
},
methods: {
verifyChallenge(response) {
// CaptchaService.verifyChallenge({ token: response, network: process.env.CAPTCHA_NETWORK }).then((response) => {
// this.$emit('setCaptchaResponse', response)
// })
if (this.enableCaptcha) {
CaptchaService.verifyChallenge({ token: response, network: process.env.CAPTCHA_NETWORK }).then((response) => {
this.$emit('setCaptchaResponse', response)
})
} else {
this.$emit('setCaptchaResponse', { success: true })
}
}
}
}
Expand Down

0 comments on commit e14b54c

Please sign in to comment.