Skip to content

Commit

Permalink
return promise when refreshing recaptcha token.
Browse files Browse the repository at this point in the history
This allows refreshing the reCAPTCHA token and to be notified once the token has been refreshed.
  • Loading branch information
Eric Pfeiffer committed Jun 10, 2020
1 parent 8f966c5 commit 905e926
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions resources/views/googlerecaptchav3/template.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ function onloadCallback() {

<script {!! $nonce !!}>
function refreshReCaptchaV3(fieldId,action){
grecaptcha.reset(window['client'+fieldId]);
grecaptcha.ready(function () {
grecaptcha.execute(window['client'+fieldId], {
action: action
return new Promise(function (resolve, reject) {
grecaptcha.ready(function () {
grecaptcha.execute(window['client'+fieldId], {
action: action
}).then(resolve);
});
});
}
Expand Down

0 comments on commit 905e926

Please sign in to comment.