Skip to content

Commit 2267776

Browse files
committed
Provider: fix scoring [closes #65]
1 parent 7c68d59 commit 2267776

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎src/ReCaptchaProvider.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ public function validate(string $response): ?ReCaptchaResponse
6363
$answer = json_decode($response, true);
6464

6565
// Return response
66-
return $answer['success'] === true && $answer['score'] >= $this->minimalScore ? new ReCaptchaResponse(true) : new ReCaptchaResponse(false, $answer['error-codes'] ?? null);
66+
return ($answer['success'] === true && ($this->minimalScore <= 0
67+
|| !isset($answer['score']) || $answer['score'] >= $this->minimalScore))
68+
? new ReCaptchaResponse(true)
69+
: new ReCaptchaResponse(false, $answer['error-codes'] ?? null);
6770
}
6871

6972
public function validateControl(BaseControl $control): bool

0 commit comments

Comments
 (0)