Skip to content

Commit

Permalink
Add reCaptcha validation logging
Browse files Browse the repository at this point in the history
  • Loading branch information
conache committed Jul 22, 2024
1 parent a63a4f6 commit 47acfe8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions faucet.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ app.post('/send', async (req, res, next) => {
const {chain, address, recapcha_token} = req.body;
// Verify recaptcha
const recaptchaVerification = await getRecaptchaVerification(recapcha_token);
console.log('recaptchaVerification response:', JSON.stringify(recaptchaVerification, null, 2));
if (!recaptchaVerification.success) {
return res.status(401).json({ code: 1, message: 'Recaptcha verification failed' });
}
Expand Down Expand Up @@ -238,6 +239,7 @@ app.listen(conf.port, () => {

async function getRecaptchaVerification(token) {
const secret = process.env.RECAPTCHA_SECRET;
console.log("Fetching recaptcha verification:", `https://www.google.com/recaptcha/api/siteverify?secret=${secret}&response=${token}`)
const response = await fetch(`https://www.google.com/recaptcha/api/siteverify?secret=${secret}&response=${token}`, {
method: 'POST',
});
Expand Down

0 comments on commit 47acfe8

Please sign in to comment.