Skip to content

Commit

Permalink
Google Recaptcha: add secret key
Browse files Browse the repository at this point in the history
  • Loading branch information
falkodev committed Jan 17, 2025
1 parent 5584acb commit 6c98840
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion server/modules/@apostrophecms/global/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ module.exports = {
type: 'string',
help: 'Site key for reCAPTCHA v3',
},
recaptchaSecretKey: {
type: 'string',
help: 'Secret key for reCAPTCHA v3',
},
newsletterText: {
type: 'string',
textarea: true,
Expand Down Expand Up @@ -155,7 +159,7 @@ module.exports = {
recaptcha: {
label: 'Google reCAPTCHA',
fields: [
'recaptchaSiteKey',
'recaptchaSiteKey', 'recaptchaSecretKey',
],
},
newsletter: {
Expand Down
3 changes: 2 additions & 1 deletion server/modules/contact/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ module.exports = {
}

console.log('req.body[g-recaptcha-response] ====> ', req.body['g-recaptcha-response'])
console.log('req.data.global.recaptchaSecretKey ====> ', req.data.global.recaptchaSecretKey)

try {
const body = JSON.stringify({
secret: '6LdfWLoqAAAAAGIIJoyuu6_JCDycm7_kdiRtZ1-y',
secret: req.data.global.recaptchaSecretKey,
response: req.body['g-recaptcha-response'],
})
const challenge = await fetch('https://www.google.com/recaptcha/api/siteverify', {
Expand Down

0 comments on commit 6c98840

Please sign in to comment.