Skip to content

Commit

Permalink
⚡ Refactor client ip logic
Browse files Browse the repository at this point in the history
IamSwap committed Mar 15, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent cc5e12e commit b7a8551
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/GoogleRecaptchaServiceProvider.php
Original file line number Diff line number Diff line change
@@ -22,13 +22,11 @@ public function boot()

// Register validator
Validator::extend('recaptcha', function ($attribute, $value, $parameters, $validator) {
$ip = request()->getClientIp();

$recaptcha = new ReCaptcha(config('google-recaptcha.secret'));

$resp = $recaptcha->verify($value, $ip);
$response = $recaptcha->verify($value, request()->ip());

return $resp->isSuccess();
return $response->isSuccess();
}, 'Failed to verify recaptcha!');
}

0 comments on commit b7a8551

Please sign in to comment.