make v2 key and v3 key configureable / check their usage
grosser opened this issue · comments
@grosser
v2 and v3 have same site key formats.
But only v3 needs action. So I think it would be better to separate the 2 config keys and change verify_recaptcha
method to use v3 key when it has the argument action. What do you think?
that would force all users to update their config ?
... can we set an optional version = :v3
config and than raise when we think it's used wrong ?
I have been thinking about the following
- Add optional v2_site_key and v3_site_key to config
- Use v3_site_key if argument
action
is present, use site_key if v3_site_key is not set - Use v2_site_key if there is no
action
argument, or use the site_key if the v2_site_key is not set
But I suppose we could also do the following
- Add optional v2_site_key and v3_site_key to config
- Add an optional argument version (default: nil) to the
verify_recaptcha
method - Use the site_key when
version = nil
- Use the v2_site_key when
version = :v2
- Use the v3_site_key when
version = :v3
- version = :v3 raise if the v3_site_key is not set to config and not passed or the argument action is not passed
I am thinking that adding version to config may not be a good idea since v3 and v2 may both be used in the same application.
the first option sounds like a smooth transition from the unified key
and will allow using both in the same app :)
Thank you.
I would like to implement this in the first option
Add optional v2_site_key and v3_site_key to config
Use v3_site_key if argument action is present, use site_key if v3_site_key is not set
Use v2_site_key if there is no action argument, or use the site_key if the v2_site_key is not set