Skip to content

Commit

Permalink
render interval
Browse files Browse the repository at this point in the history
  • Loading branch information
karliuka committed Sep 17, 2018
1 parent e38318d commit 15cd5a0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
11 changes: 7 additions & 4 deletions view/adminhtml/web/js/reCaptcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function($) {
type: 'image',
size: 'normal',
theme: 'light',
sitekey: null
sitekey: null
},

/**
Expand All @@ -43,9 +43,12 @@ function($) {
* @returns {void}
*/
_render: function(element) {
if (typeof grecaptcha != 'undefined') {
grecaptcha.render(element, this.options);
}
var interval = setInterval(function() {
if (typeof grecaptcha != 'undefined') {
var id = grecaptcha.render(element, this.options);
clearInterval(interval);
}
}.bind(this), 1000);
}
});

Expand Down
17 changes: 10 additions & 7 deletions view/frontend/web/js/reCaptcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,16 @@ function($, login) {
* @returns {void}
*/
_render: function(element) {
if (typeof grecaptcha != 'undefined') {
var id = grecaptcha.render(element, this.options);
login.registerLoginCallback(function(data) {
grecaptcha.reset(id);
}.bind(this));
}
}
var interval = setInterval(function() {
if (typeof grecaptcha != 'undefined') {
var id = grecaptcha.render(element, this.options);
login.registerLoginCallback(function(data) {
grecaptcha.reset(id);
}.bind(this));
clearInterval(interval);
}
}.bind(this), 1000);
}
});

return $.faonni.reCaptcha;
Expand Down

0 comments on commit 15cd5a0

Please sign in to comment.