Set minimal score for validation - #64
Merged
Merged
Conversation
f3l1x
reviewed
Dec 7, 2023
| public function setMinimalScore(float $score): self | ||
| { | ||
| if ($score < 0 || $score > 1) { | ||
| throw new InvalidScoreException('Minimal score expects to be in range 0..1 (1.0 is very likely a good interaction, 0.0 is very likely a bot).'); |
Member
There was a problem hiding this comment.
Can you use LogicException? There is no need to have a custom class for this.
Member
|
👍 Thanks |
|
See issue #65 , in reCaptcha 2 is problem with nonexisting $answer['score'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For better spam filtering, you can use the score returned by Google. The score is in range 0..1 (1.0 is very likely a good interaction, 0.0 is very likely a bot).
How to use it?
Global settings for all forms in config.neon
Or you can define it for each form separately.
Or you can have the score set globally and then set it differently for some forms.
The score set in the form has a higher priority.