Skip to content

Commit

Permalink
Merge pull request #1 from becquerel/feature/use-recaptcha-domain
Browse files Browse the repository at this point in the history
add ability to change recaptcha domain closes greggilbert#159
  • Loading branch information
becquerel authored Mar 20, 2019
2 parents c2ed383 + 879b766 commit 11c0092
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/config/recaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,16 @@

'version' => 2,

/*
|--------------------------------------------------------------------------
| Recaptcha domain
|--------------------------------------------------------------------------
|
| This can be set either to www.google.com or www.recaptcha.net for use in
| locations where www.google.com is not available
| https://developers.google.com/recaptcha/docs/faq#can-i-use-recaptcha-globally
|
*/
'recaptcha_domain' => 'www.google.com'

];
4 changes: 2 additions & 2 deletions src/views/captcha.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
</script>
@endif
<script type="text/javascript"
src="//www.google.com/recaptcha/api/challenge?k=<?php echo $public_key ?><?php echo( isset( $lang ) ? '&hl=' . $lang : '' ) ?>"></script>
src="//{{ config('recaptcha.recaptcha_domain', 'www.google.com') }}/recaptcha/api/challenge?k=<?php echo $public_key ?><?php echo( isset( $lang ) ? '&hl=' . $lang : '' ) ?>"></script>
<noscript>
<iframe src="//www.google.com/recaptcha/api/noscript?k=<?php echo $public_key ?><?php echo( isset( $lang ) ? '&hl=' . $lang : '' ) ?>"
<iframe src="//{{ config('recaptcha.recaptcha_domain', 'www.google.com') }}/recaptcha/api/noscript?k=<?php echo $public_key ?><?php echo( isset( $lang ) ? '&hl=' . $lang : '' ) ?>"
height="300" width="500" frameborder="0"></iframe>
<br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
Expand Down
4 changes: 2 additions & 2 deletions src/views/captchav2.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ function renderDataAttributes($attributes)
var RecaptchaOptions = <?=json_encode($options) ?>;
</script>
@endif
<script src='https://www.google.com/recaptcha/api.js?render=onload{{ (isset($lang) ? '&hl='.$lang : '') }}'></script>
<script src='https://{{ config('recaptcha.recaptcha_domain', 'www.google.com') }}/recaptcha/api.js?render=onload{{ (isset($lang) ? '&hl='.$lang : '') }}'></script>
<div class="g-recaptcha" data-sitekey="{{ $public_key }}" <?=renderDataAttributes($dataParams)?>></div>
<noscript>
<div style="width: 302px; height: 352px;">
<div style="width: 302px; height: 352px; position: relative;">
<div style="width: 302px; height: 352px; position: absolute;">
<iframe src="https://www.google.com/recaptcha/api/fallback?k={{ $public_key }}"
<iframe src="https://{{ config('recaptcha.recaptcha_domain', 'www.google.com') }}/recaptcha/api/fallback?k={{ $public_key }}"
frameborder="0" scrolling="no"
style="width: 302px; height:352px; border-style: none;">
</iframe>
Expand Down

0 comments on commit 11c0092

Please sign in to comment.