Skip to content

Commit

Permalink
Default to verify curl, but allow it to be disabled (fixes greggilber…
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Gilbert committed Apr 6, 2017
1 parent cffaaa6 commit 298cbc0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
"dev-master": "2.2-dev"
}
},
"minimum-stability": "dev"
Expand Down
8 changes: 7 additions & 1 deletion src/Service/CheckRecaptchaV2.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,15 @@ public function check($challenge, $response)
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, app('config')->get('recaptcha.options.curl_timeout', 1));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
if(app('config')->get('recaptcha.options.curl_verify') === false) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
}

$checkResponse = curl_exec($curl);

if(false === $checkResponse) {
app('log')->error('[Recaptcha] CURL error: '.curl_error($curl));
}
} else {
$checkResponse = file_get_contents($url);
}
Expand Down
1 change: 1 addition & 0 deletions src/config/recaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
'options' => [

'curl_timeout' => 1,
'curl_verify' => true,

],

Expand Down

0 comments on commit 298cbc0

Please sign in to comment.