griesoft/orchardcore-recaptcha

Is there any way to customise the score/threshold for validations?

Closed this issue · 1 comments

According to Google's documentation on reCaptcha v3, there is a score parameter returned with each validation. See https://developers.google.com/recaptcha/docs/v3#interpreting_the_score

By default, a 0.5 threshold can be used, but there is no place in the config pages of your plugin to tweak that value in case we want to tighten or relax validations. Only the Site Key and Secret Key values are configurable:

image

We are using Workflows and for the tasks used there, no configurable score is avalable either:

workflow

Where should we do that? Does your plugin have support for this? Are you planning to add it? Thanks.

Glad you asked!

The score value is actually set to a workflow property with the name RecaptchaScore. With this you can use an If / Else task to check whether the score is in the desired range or not. The javascript expression for the task could look something like property('RecaptchaScore') >= 0.7.

Disclaimer: I haven't tested that expression, but based on the documentation this should work.

To make this validation of the score more convenient I have planned to add this to the validation task itself. I might be able to do that in the next couple of weeks, can't promise it thou. Until then, you have to go with that extra if/else task in between.