|
7 | 7 | $config = $block->getCaptchaUiConfig();
|
8 | 8 | $renderingOptions = $config['rendering'] ?? [];
|
9 | 9 | $isInvisible = !empty($config['invisible']);
|
10 |
| -$isBadgeInline = (isset($renderingOptions['badge']) && $renderingOptions['badge']=='inline') ? true : false; |
11 | 10 | ?>
|
12 | 11 | <div class="admin__field <?= /* @noEscape */ $isInvisible ? 'field-invisible-recaptcha' : 'field-recaptcha' ?>">
|
13 | 12 | <div id="admin-recaptcha"
|
@@ -46,32 +45,16 @@ $isBadgeInline = (isset($renderingOptions['badge']) && $renderingOptions['badge'
|
46 | 45 | <?php if ($isInvisible): ?>
|
47 | 46 | $('#login-form').submit(function (event) {
|
48 | 47 | 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 | + }); |
62 | 54 | }
|
63 | 55 | }.bind(this));
|
64 | 56 | <?php endif; ?>
|
65 | 57 |
|
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 |
| - |
75 | 58 | }.bind(this);
|
76 | 59 |
|
77 | 60 | scriptTag.parentNode.insertBefore(element, scriptTag);
|
|
0 commit comments