Skip to content

Commit

Permalink
fix/china-recaptcha: Fix recaptcha not working in China
Browse files Browse the repository at this point in the history
  • Loading branch information
christianesperar committed Sep 30, 2019
1 parent 73d01e4 commit 548b113
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions release/angular-recaptcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
// Check if grecaptcha.render is not defined already.
if (isRenderFunctionAvailable()) {
callback();
} else if ($window.document.querySelector('script[src^="https://www.google.com/recaptcha/api.js"]')) {
} else if ($window.document.querySelector('script[src^="https://www.recaptcha.net/recaptcha/api.js"]')) {
// wait for script to be loaded.
var intervalWait = $interval(function() {
if (isRenderFunctionAvailable()) {
Expand All @@ -173,7 +173,7 @@
var script = $window.document.createElement('script');
script.async = true;
script.defer = true;
script.src = 'https://www.google.com/recaptcha/api.js?onload='+provider.onLoadFunctionName+'&render=explicit';
script.src = 'https://www.recaptcha.net/recaptcha/api.js?onload='+provider.onLoadFunctionName+'&render=explicit';
$document.find('body')[0].appendChild(script);
}

Expand Down
2 changes: 1 addition & 1 deletion release/angular-recaptcha.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
// Check if grecaptcha.render is not defined already.
if (isRenderFunctionAvailable()) {
callback();
} else if ($window.document.querySelector('script[src^="https://www.google.com/recaptcha/api.js"]')) {
} else if ($window.document.querySelector('script[src^="https://www.recaptcha.net/recaptcha/api.js"]')) {
// wait for script to be loaded.
var intervalWait = $interval(function() {
if (isRenderFunctionAvailable()) {
Expand All @@ -159,7 +159,7 @@
var script = $window.document.createElement('script');
script.async = true;
script.defer = true;
script.src = 'https://www.google.com/recaptcha/api.js?onload='+provider.onLoadFunctionName+'&render=explicit';
script.src = 'https://www.recaptcha.net/recaptcha/api.js?onload='+provider.onLoadFunctionName+'&render=explicit';
$document.find('body')[0].appendChild(script);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/service_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ describe('service', function () {
});

it('should add callback function name to src', function () {
expect(scriptTagSpy.src).toBe('https://www.google.com/recaptcha/api.js?onload=' + funcName + '&render=explicit');
expect(scriptTagSpy.src).toBe('https://www.recaptcha.net/recaptcha/api.js?onload=' + funcName + '&render=explicit');
});

it('should validate that recaptcha is loaded', function () {
Expand Down

0 comments on commit 548b113

Please sign in to comment.