pdupavillon / express-recaptcha

Implementation of google recaptcha v2 & V3 solutions for express.js
MIT License
128 stars 21 forks source link

Unclear how to pass options to Recaptcha (as a dictionary ? as labelled variables?) #23

Closed yiorgosn closed 5 years ago

yiorgosn commented 5 years ago

var recaptcha = new Recaptcha('SITE_KEY', 'SECRET_KEY', options); I can't seem to pass any options ie {"theme" : "dark"} or theme="dark"?

pdupavillon commented 5 years ago

Hi @yiorgosn,

this is how to use it. I've updated the documentation consequently.

var options = {'theme':'dark'};
var recaptcha = new Recaptcha('SITE_KEY', 'SECRET_KEY', options);
yiorgosn commented 5 years ago

Thank you very much Paul for your immediate reply. Passing the dictionary should have worked also as I first tried. It still doesn't change theme colors on my end. It must be some other setting on my end that is not letting the dark theme work. Cheers!

pdupavillon commented 5 years ago

You can check the example/server.js file if you want, I specified the dark theme in it.

yiorgosn commented 5 years ago

Paul, I upgraded to version recaptcha 4.1.1 (Using site type v2 recaptcha) and followed both ways of passing the parameter.
Option 1: As a variable, options={'theme':'dark'} when i declare recaptcha and then used recaptcha.middleware.render in my route and Option 2: Just using recaptcha.middleware.renderWith({'theme':'dark'}) in the route and not declaring an options variable in advance. It still won't display the dark theme but your software otherwise works very well. It is a pleasure to use. Thank you.