Skip to content

Commit 35e4a76

Browse files
author
hwyu@adobe.com
committed
MC-40818: Disable clipboard for cc inputs
- Fixed static test failures
1 parent 7eab997 commit 35e4a76

File tree

7 files changed

+65
-42
lines changed

7 files changed

+65
-42
lines changed

app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/info.phtml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
4040
'validate-cc-type-select':'#<?= /* @noEscape */ $code ?>_cc_number'
4141
}">
4242
<option value=""><?= $block->escapeHtml(__('Please Select')) ?></option>
43-
<?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName) : ?>
43+
<?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName): ?>
4444
<option value="<?= $block->escapeHtmlAttr($typeCode) ?>"
45-
<?php if ($typeCode == $ccType) : ?>selected="selected"<?php endif; ?>>
45+
<?php if ($typeCode == $ccType): ?>selected="selected"<?php endif; ?>>
4646
<?= $block->escapeHtml($typeName) ?>
4747
</option>
4848
<?php endforeach; ?>
@@ -83,9 +83,9 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
8383
'required':true,
8484
'validate-cc-exp':'#<?= /* @noEscape */ $code ?>_expiration_yr'
8585
}">
86-
<?php foreach ($block->getCcMonths() as $k => $v) : ?>
86+
<?php foreach ($block->getCcMonths() as $k => $v): ?>
8787
<option value="<?= $block->escapeHtmlAttr($k) ?>"
88-
<?php if ($k == $ccExpMonth) : ?>selected="selected"<?php endif; ?>>
88+
<?php if ($k == $ccExpMonth): ?>selected="selected"<?php endif; ?>>
8989
<?= $block->escapeHtml($v) ?>
9090
</option>
9191
<?php endforeach; ?>
@@ -95,17 +95,17 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
9595
class="admin__control-select admin__control-select-year"
9696
data-container="<?= /* @noEscape */ $code ?>-cc-year"
9797
data-validate="{required:true}">
98-
<?php foreach ($block->getCcYears() as $k => $v) : ?>
98+
<?php foreach ($block->getCcYears() as $k => $v): ?>
9999
<option value="<?= /* @noEscape */ $k ? $block->escapeHtmlAttr($k) : '' ?>"
100-
<?php if ($k == $ccExpYear) : ?>selected="selected"<?php endif; ?>>
100+
<?php if ($k == $ccExpYear): ?>selected="selected"<?php endif; ?>>
101101
<?= $block->escapeHtml($v) ?>
102102
</option>
103103
<?php endforeach; ?>
104104
</select>
105105
</div>
106106
</div>
107107

108-
<?php if ($block->hasVerification()) : ?>
108+
<?php if ($block->hasVerification()): ?>
109109
<div class="admin__field _required field-cvv">
110110
<label class="admin__field-label"
111111
for="<?= /* @noEscape */ $code ?>_cc_cid"

app/code/Magento/AuthorizenetAcceptjs/view/adminhtml/templates/form/cc.phtml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
2222
<select id="<?= /* @noEscape */ $code ?>_cc_type" name="payment[cc_type]"
2323
class="required-entry validate-cc-type-select admin__control-select">
2424
<option value=""></option>
25-
<?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName) : ?>
26-
<option value="<?= $block->escapeHtmlAttr($typeCode) ?>" <?php if ($typeCode == $ccType) : ?>selected="selected"<?php endif ?>>
25+
<?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName): ?>
26+
<option value="<?= $block->escapeHtmlAttr($typeCode) ?>"
27+
<?php if ($typeCode == $ccType): ?>selected="selected"<?php endif ?>>
2728
<?= $block->escapeHtml($typeName) ?>
2829
</option>
2930
<?php endforeach ?>
@@ -53,26 +54,26 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
5354
<div class="admin__field-control">
5455
<select id="<?= /* @noEscape */ $code ?>_cc_exp_month" name="payment[cc_exp_month]"
5556
class="admin__control-select admin__control-select-month validate-cc-exp required-entry">
56-
<?php foreach ($block->getCcMonths() as $k => $v) : ?>
57+
<?php foreach ($block->getCcMonths() as $k => $v): ?>
5758
<option value="<?= $block->escapeHtmlAttr($k) ?>"
58-
<?php if ($k == $ccExpMonth) : ?>selected="selected"<?php endif ?>>
59+
<?php if ($k == $ccExpMonth): ?>selected="selected"<?php endif ?>>
5960
<?= $block->escapeHtml($v) ?>
6061
</option>
6162
<?php endforeach; ?>
6263
</select>
6364
<select id="<?= /* @noEscape */ $code ?>_cc_exp_year" name="payment[cc_exp_year]"
6465
class="admin__control-select admin__control-select-year required-entry">
65-
<?php foreach ($block->getCcYears() as $k => $v) : ?>
66+
<?php foreach ($block->getCcYears() as $k => $v): ?>
6667
<option value="<?= /* @noEscape */ $k ? $block->escapeHtml($k) : '' ?>"
67-
<?php if ($k == $ccExpYear) : ?>selected="selected"<?php endif ?>>
68+
<?php if ($k == $ccExpYear): ?>selected="selected"<?php endif ?>>
6869
<?= $block->escapeHtml($v) ?>
6970
</option>
7071
<?php endforeach ?>
7172
</select>
7273
</div>
7374
</div>
7475

75-
<?php if ($block->isCvvEnabled()) : ?>
76+
<?php if ($block->isCvvEnabled()): ?>
7677
<div class="field-number required admin__field _required">
7778
<label class="admin__field-label" for="<?= /* @noEscape */ $code ?>_cc_cid">
7879
<span><?= $block->escapeHtml(__('Card Verification Number')) ?></span>

app/code/Magento/Payment/view/adminhtml/templates/form/cc.phtml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
2222
<select id="<?= /* @noEscape */ $code ?>_cc_type" name="payment[cc_type]"
2323
class="required-entry validate-cc-type-select admin__control-select">
2424
<option value=""></option>
25-
<?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName) : ?>
26-
<option value="<?= $block->escapeHtmlAttr($typeCode) ?>" <?php if ($typeCode == $ccType) : ?>selected="selected"<?php endif ?>>
25+
<?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName): ?>
26+
<option value="<?= $block->escapeHtmlAttr($typeCode) ?>"
27+
<?php if ($typeCode == $ccType): ?>selected="selected"<?php endif ?>>
2728
<?= $block->escapeHtml($typeName) ?>
2829
</option>
2930
<?php endforeach ?>
@@ -52,26 +53,26 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
5253
<div class="admin__field-control">
5354
<select id="<?= /* @noEscape */ $code ?>_expiration" name="payment[cc_exp_month]"
5455
class="admin__control-select admin__control-select-month validate-cc-exp required-entry">
55-
<?php foreach ($block->getCcMonths() as $k => $v) : ?>
56+
<?php foreach ($block->getCcMonths() as $k => $v): ?>
5657
<option value="<?= $block->escapeHtmlAttr($k) ?>"
57-
<?php if ($k == $ccExpMonth) : ?>selected="selected"<?php endif ?>>
58+
<?php if ($k == $ccExpMonth): ?>selected="selected"<?php endif ?>>
5859
<?= $block->escapeHtml($v) ?>
5960
</option>
6061
<?php endforeach; ?>
6162
</select>
6263
<select id="<?= /* @noEscape */ $code ?>_expiration_yr" name="payment[cc_exp_year]"
6364
class="admin__control-select admin__control-select-year required-entry">
64-
<?php foreach ($block->getCcYears() as $k => $v) : ?>
65+
<?php foreach ($block->getCcYears() as $k => $v): ?>
6566
<option value="<?= /* @noEscape */ $k ? $block->escapeHtml($k) : '' ?>"
66-
<?php if ($k == $ccExpYear) : ?>selected="selected"<?php endif ?>>
67+
<?php if ($k == $ccExpYear): ?>selected="selected"<?php endif ?>>
6768
<?= $block->escapeHtml($v) ?>
6869
</option>
6970
<?php endforeach ?>
7071
</select>
7172
</div>
7273
</div>
7374

74-
<?php if ($block->hasVerification()) : ?>
75+
<?php if ($block->hasVerification()): ?>
7576
<div class="field-number required admin__field _required">
7677
<label class="admin__field-label" for="<?= /* @noEscape */ $code ?>_cc_cid">
7778
<span><?= $block->escapeHtml(__('Card Verification Number')) ?></span>

app/code/Magento/Payment/view/frontend/templates/form/cc.phtml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
2929
}'
3030
class="select">
3131
<option value=""><?= $block->escapeHtml(__('--Please Select--')) ?></option>
32-
<?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName) : ?>
32+
<?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName): ?>
3333
<option value="<?= $block->escapeHtmlAttr($typeCode) ?>"
34-
<?php if ($typeCode == $ccType) : ?> selected="selected"<?php endif; ?>>
34+
<?php if ($typeCode == $ccType): ?> selected="selected"<?php endif; ?>>
3535
<?= $block->escapeHtml($typeName) ?>
3636
</option>
3737
<?php endforeach; ?>
@@ -67,11 +67,17 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
6767
<div class="fields group group-2">
6868
<div class="field no-label month">
6969
<div class="control">
70-
<select id="<?= /* @noEscape */ $code ?>_expiration" name="payment[cc_exp_month]" class="select month"
71-
data-validate='{required:true, "validate-cc-exp":"#<?= /* @noEscape */ $code ?>_expiration_yr"}'>
72-
<?php foreach ($block->getCcMonths() as $k => $v) : ?>
70+
<select
71+
id="<?= /* @noEscape */ $code ?>_expiration"
72+
name="payment[cc_exp_month]"
73+
class="select month"
74+
data-validate='{
75+
required:true,
76+
"validate-cc-exp":"#<?= /* @noEscape */ $code ?>_expiration_yr"
77+
}'>
78+
<?php foreach ($block->getCcMonths() as $k => $v): ?>
7379
<option value="<?= /* @noEscape */ $k ? $block->escapeHtml($k) : '' ?>"
74-
<?php if ($k == $ccExpMonth) : ?> selected="selected"<?php endif; ?>>
80+
<?php if ($k == $ccExpMonth): ?> selected="selected"<?php endif; ?>>
7581
<?= $block->escapeHtml($v) ?>
7682
</option>
7783
<?php endforeach; ?>
@@ -82,9 +88,9 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
8288
<div class="control">
8389
<select id="<?= /* @noEscape */ $code ?>_expiration_yr" name="payment[cc_exp_year]"
8490
class="select year" data-validate='{required:true}'>
85-
<?php foreach ($block->getCcYears() as $k => $v) : ?>
91+
<?php foreach ($block->getCcYears() as $k => $v): ?>
8692
<option value="<?= /* @noEscape */ $k ? $block->escapeHtml($k) : '' ?>
87-
"<?php if ($k == $ccExpYear) : ?> selected="selected"<?php endif; ?>>
93+
"<?php if ($k == $ccExpYear): ?> selected="selected"<?php endif; ?>>
8894
<?= $block->escapeHtml($v) ?>
8995
</option>
9096
<?php endforeach; ?>
@@ -94,7 +100,7 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
94100
</div>
95101
</div>
96102
</div>
97-
<?php if ($block->hasVerification()) : ?>
103+
<?php if ($block->hasVerification()): ?>
98104
<div class="field cvv required" id="<?= /* @noEscape */ $code ?>_cc_type_cvv_div">
99105
<label for="<?= /* @noEscape */ $code ?>_cc_cid" class="label">
100106
<span><?= $block->escapeHtml(__('Card Verification Number')) ?></span>
@@ -109,7 +115,8 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
109115
id="<?= /* @noEscape */ $code ?>_cc_cid"
110116
name="payment[cc_cid]"
111117
value=""
112-
data-validate='{"required-number":true, "validate-cc-cvn":"#<?= /* @noEscape */ $code ?>_cc_type"}' />
118+
data-validate='{"required-number":true, "validate-cc-cvn":"#<?= /* @noEscape */ $code ?>_cc_type"}'
119+
/>
113120
<?php $content = '<img src=\"' . $block->getViewFileUrl('Magento_Checkout::cvv.png') . '\" alt=\"' .
114121
$block->escapeHtml(__('Card Verification Number Visual Reference')) .
115122
'\" title=\"' . $block->escapeHtml(__('Card Verification Number Visual Reference')) . '\" />'; ?>

app/code/Magento/Payment/view/frontend/web/js/view/payment/cc-form.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,15 @@ define([
192192
'" />';
193193
},
194194

195+
/**
196+
* Get image for CVV for Unsanitized Html
197+
* @returns {String}
198+
*/
199+
getCvvImageUnsanitizedHtml: function () {
200+
return this.getCvvImageHtml();
201+
},
202+
203+
195204
/**
196205
* @deprecated
197206
* @returns {Object}

app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
</span>
129129
<div class="field-tooltip-content"
130130
data-target="dropdown"
131-
data-bind="html: getCvvImageHtml()"></div>
131+
data-bind="html: getCvvImageUnsanitizedHtml()"></div>
132132
</div>
133133
</div>
134134
</div>

app/code/Magento/Paypal/view/adminhtml/templates/transparent/form.phtml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ $ccExpMonth = $block->getInfoData('cc_exp_month');
3131
"orderSaveUrl":"<?= $block->escapeUrl($block->getOrderUrl()) ?>",
3232
"cgiUrl":"<?= $block->escapeUrl($block->getCgiUrl()) ?>",
3333
"expireYearLength":"<?= $block->escapeHtml($block->getMethodConfigData('cc_year_length')) ?>",
34-
"nativeAction":"<?= $block->escapeUrl($block->getUrl('*/*/save', ['_secure' => $block->getRequest()->isSecure()])) ?>"
34+
"nativeAction":"<?= $block->escapeUrl(
35+
$block->getUrl('*/*/save', ['_secure' => $block->getRequest()->isSecure()])
36+
) ?>"
3537
}, "validation":[]}'
3638
style="display: none;">
3739
<div class="admin__field _required">
@@ -46,9 +48,10 @@ $ccExpMonth = $block->getInfoData('cc_exp_month');
4648
data-validate='{required:true, "validate-cc-type-select":"#<?= /* @noEscape */ $code ?>_cc_number"}'
4749
class="admin__control-select">
4850
<option value=""><?= $block->escapeHtml(__('Please Select')) ?></option>
49-
<?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName) : ?>
51+
<?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName): ?>
5052
<option
51-
value="<?= $block->escapeHtmlAttr($typeCode) ?>"<?php if ($typeCode == $ccType) : ?> selected="selected"<?php endif ?>>
53+
value="<?= $block->escapeHtmlAttr($typeCode) ?>"<?php if ($typeCode == $ccType): ?>
54+
selected="selected"<?php endif ?>>
5255
<?= $block->escapeHtml($typeName) ?>
5356
</option>
5457
<?php endforeach ?>
@@ -89,10 +92,10 @@ $ccExpMonth = $block->getInfoData('cc_exp_month');
8992
data-container="<?= /* @noEscape */ $code ?>-cc-month"
9093
class="admin__control-select admin__control-select-month"
9194
data-validate='{required:true, "validate-cc-exp":"#<?= /* @noEscape */ $code ?>_expiration_yr"}'>
92-
<?php foreach ($block->getCcMonths() as $k => $v) : ?>
95+
<?php foreach ($block->getCcMonths() as $k => $v): ?>
9396
<option
9497
value="<?= /* @noEscape */ $k ? $block->escapeHtml($k) : '' ?>"
95-
<?php if ($k == $ccExpMonth) : ?> selected="selected"<?php endif; ?>>
98+
<?php if ($k == $ccExpMonth): ?> selected="selected"<?php endif; ?>>
9699
<?= $block->escapeHtml($v) ?>
97100
</option>
98101
<?php endforeach ?>
@@ -101,17 +104,17 @@ $ccExpMonth = $block->getInfoData('cc_exp_month');
101104
<select id="<?= /* @noEscape */ $code ?>_expiration_yr" name="payment[cc_exp_year]"
102105
class="admin__control-select admin__control-select-year"
103106
data-container="<?= /* @noEscape */ $code ?>-cc-year" data-validate='{required:true}'>
104-
<?php foreach ($block->getCcYears() as $k => $v) : ?>
107+
<?php foreach ($block->getCcYears() as $k => $v): ?>
105108
<option
106109
value="<?= /* @noEscape */ $k ? $block->escapeHtml($k) : '' ?>"
107-
<?php if ($k == $ccExpYear) : ?> selected="selected"<?php endif ?>>
110+
<?php if ($k == $ccExpYear): ?> selected="selected"<?php endif ?>>
108111
<?= $block->escapeHtml($v) ?>
109112
</option>
110113
<?php endforeach ?>
111114
</select>
112115
</div>
113116
</div>
114-
<?php if ($block->hasVerification()) : ?>
117+
<?php if ($block->hasVerification()): ?>
115118
<div class="admin__field _required field-cvv" id="<?= /* @noEscape */ $code ?>_cc_type_cvv_div">
116119
<label for="<?= /* @noEscape */ $code ?>_cc_cid" class="admin__field-label">
117120
<span><?= $block->escapeHtml(__('Card Verification Number')) ?></span>
@@ -126,13 +129,15 @@ $ccExpMonth = $block->getInfoData('cc_exp_month');
126129
class="admin__control-text cvv"
127130
id="<?= /* @noEscape */ $code ?>_cc_cid" name="payment[cc_cid]"
128131
value=""
129-
data-validate='{"required-number":true, "validate-cc-cvn":"#<?= /* @noEscape */ $code ?>_cc_type"}'
132+
data-validate='{
133+
"required-number":true,
134+
"validate-cc-cvn":"#<?= /* @noEscape */ $code ?>_cc_type"}'
130135
autocomplete="off"/>
131136
</div>
132137
</div>
133138
<?php endif; ?>
134139

135-
<?php if ($block->isVaultEnabled()) : ?>
140+
<?php if ($block->isVaultEnabled()): ?>
136141
<div class="admin__field admin__field-option field-tooltip-content">
137142
<input type="checkbox"
138143
id="<?= /* @noEscape */ $code ?>_vault"

0 commit comments

Comments
 (0)