Skip to content

Commit df8f4ba

Browse files
committed
Format code
1 parent 6af0ba5 commit df8f4ba

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
$config = $block->getCaptchaUiConfig();
88
$renderingOptions = $config['rendering'] ?? [];
99
$isInvisible = !empty($config['invisible']);
10-
$isBadgeInline = (isset($renderingOptions['badge']) && $renderingOptions['badge']=='inline') ? true : false;
1110
?>
1211
<div class="admin__field <?= /* @noEscape */ $isInvisible ? 'field-invisible-recaptcha' : 'field-recaptcha' ?>">
1312
<div id="admin-recaptcha"
@@ -46,32 +45,16 @@ $isBadgeInline = (isset($renderingOptions['badge']) && $renderingOptions['badge'
4645
<?php if ($isInvisible): ?>
4746
$('#login-form').submit(function (event) {
4847
if (!this.token) {
49-
<?php if (!$isBadgeInline) : ?>
50-
event.preventDefault(event);
51-
event.stopImmediatePropagation();
52-
grecaptcha.execute(this.widgetId);
53-
<?php else: ?>
54-
this.resultSuccessCallback = false;
55-
let recaptchaResultExecute = grecaptcha.execute(this.widgetId);
56-
recaptchaResultExecute.then(this.successRecaptchaCallback(), this.failureRecaptchaCallback());
57-
if (this.resultSuccessCallback == true) {
58-
event.preventDefault(event);
59-
event.stopImmediatePropagation();
60-
}
61-
<?php endif; ?>
48+
grecaptcha.execute(this.widgetId).then(
49+
function() {
50+
event.preventDefault(event);
51+
event.stopImmediatePropagation();
52+
}, function(reason) {
53+
});
6254
}
6355
}.bind(this));
6456
<?php endif; ?>
6557

66-
<?php if ($isInvisible && $isBadgeInline) : ?>
67-
this.successRecaptchaCallback = function () {
68-
this.resultSuccessCallback = true;
69-
}.bind(this);
70-
71-
this.failureRecaptchaCallback = function () {
72-
}.bind(this);
73-
<?php endif; ?>
74-
7558
}.bind(this);
7659

7760
scriptTag.parentNode.insertBefore(element, scriptTag);

0 commit comments

Comments
 (0)