@@ -74,12 +74,14 @@ private function copyEnabledRecaptcha(string $scope): void
74
74
}
75
75
76
76
$ availableRecaptchaPreferences = $ this ->getAvailableRecaptchaPreferences ();
77
- foreach ($ availableRecaptchaPreferences [$ scope ] as $ availableRecaptchaPreference ) {
78
- $ availableRecaptchaPreferencePath = "recaptcha_ $ scope/type_for/ $ availableRecaptchaPreference " ;
77
+ foreach ($ availableRecaptchaPreferences [$ scope ] as $ availablePreference => $ legacyPreference ) {
78
+ $ availableRecaptchaPreferencePath = "recaptcha_ $ scope/type_for/ $ availablePreference " ;
79
79
$ recaptchaPreferenceEnabled = $ this ->scopeConfig ->getValue ($ availableRecaptchaPreferencePath );
80
- $ recaptchaPreferenceEnabledLegacy = $ this ->scopeConfig ->getValue ("recaptcha/general/enabled_for_ $ availableRecaptchaPreference " );
81
- if (null === $ recaptchaPreferenceEnabled && null !== $ recaptchaPreferenceEnabledLegacy ) {
82
- $ this ->writer ->save ($ availableRecaptchaPreferencePath , (int )$ recaptchaPreferenceEnabledLegacy ? $ type : null );
80
+ $ recaptchaPreferenceEnabledLegacy = $ this ->scopeConfig ->getValue (
81
+ "msp_securitysuite_recaptcha/ $ scope/enabled $ legacyPreference "
82
+ );
83
+ if (null === $ recaptchaPreferenceEnabled && '0 ' !== $ recaptchaPreferenceEnabledLegacy ) {
84
+ $ this ->writer ->save ($ availableRecaptchaPreferencePath , $ type );
83
85
}
84
86
}
85
87
}
@@ -93,8 +95,13 @@ private function copyRecaptchaKeys(string $scope): void
93
95
{
94
96
$ keys = ['public_key ' , 'private_key ' ];
95
97
$ type = $ this ->getActiveRecaptchaType ();
96
- foreach ($ keys as $ key ) {
97
- $ this ->copyRecord ("recaptcha/general/ $ key " , "recaptcha_ $ scope/type_ $ type/ $ key " );
98
+ if ($ type ) {
99
+ foreach ($ keys as $ key ) {
100
+ $ this ->copyRecord (
101
+ "msp_securitysuite_recaptcha/general/ $ key " ,
102
+ "recaptcha_ $ scope/type_ $ type/ $ key "
103
+ );
104
+ }
98
105
}
99
106
}
100
107
@@ -106,8 +113,11 @@ private function copyRecaptchaKeys(string $scope): void
106
113
private function copyModuleSpecificRecords (string $ scope ): void
107
114
{
108
115
foreach ($ this ->getModuleSpecificRecords () as $ module => $ specificRecords ) {
109
- foreach ($ specificRecords as $ specificRecord ) {
110
- $ this ->copyRecord ("recaptcha/general/ $ specificRecord " , "recaptcha_ $ scope/type_ $ module/ $ specificRecord " );
116
+ foreach ($ specificRecords as $ actualRecord => $ legacyRecord ) {
117
+ $ this ->copyRecord (
118
+ "msp_securitysuite_recaptcha/ $ scope/ $ legacyRecord " ,
119
+ "recaptcha_ $ scope/type_ $ module/ $ actualRecord "
120
+ );
111
121
}
112
122
}
113
123
}
@@ -120,9 +130,21 @@ private function copyModuleSpecificRecords(string $scope): void
120
130
private function getModuleSpecificRecords (): array
121
131
{
122
132
return [
123
- 'recaptcha ' => ['theme ' , 'lang ' , 'size ' ],
124
- 'invisible ' => ['theme ' , 'lang ' , 'position ' ],
125
- 'recaptcha_v3 ' => ['theme ' , 'lang ' , 'score_threshold ' , 'position ' ],
133
+ 'recaptcha ' => [
134
+ 'theme ' => 'theme ' ,
135
+ 'lang ' => 'lang ' ,
136
+ 'size ' => 'size '
137
+ ],
138
+ 'invisible ' => [
139
+ 'theme ' => 'theme ' ,
140
+ 'lang ' => 'lang ' ,
141
+ 'position ' => 'position '
142
+ ],
143
+ 'recaptcha_v3 ' => [
144
+ 'theme ' => 'theme ' ,
145
+ 'lang ' => 'lang ' ,
146
+ 'score_threshold ' => 'min_score ' ,
147
+ 'position ' => 'position ' ],
126
148
];
127
149
}
128
150
@@ -135,17 +157,17 @@ private function getAvailableRecaptchaPreferences(): array
135
157
{
136
158
return [
137
159
'frontend ' => [
138
- 'customer_login ' ,
139
- 'customer_forgot_password ' ,
140
- 'customer_create ' ,
141
- 'contact ' ,
142
- 'product_review ' ,
143
- 'newsletter ' ,
144
- 'sendfriend ' ,
160
+ 'customer_login ' => ' _login ' ,
161
+ 'customer_forgot_password ' => ' _forgot ' ,
162
+ 'customer_create ' => ' _create ' ,
163
+ 'contact ' => ' _contact ' ,
164
+ 'product_review ' => ' _review ' ,
165
+ 'newsletter ' => ' _newsletter ' ,
166
+ 'sendfriend ' => ' _sendfriend ' ,
145
167
],
146
168
'backend ' => [
147
- 'user_login ' ,
148
- 'user_forgot_password ' ,
169
+ 'user_login ' => '' ,
170
+ 'user_forgot_password ' => '' ,
149
171
],
150
172
];
151
173
}
@@ -157,7 +179,7 @@ private function getAvailableRecaptchaPreferences(): array
157
179
*/
158
180
private function getActiveRecaptchaType (): ?string
159
181
{
160
- return $ this ->scopeConfig ->getValue ('recaptcha /general/type ' );
182
+ return $ this ->scopeConfig ->getValue ('msp_securitysuite_recaptcha /general/type ' );
161
183
}
162
184
163
185
/**
@@ -197,9 +219,7 @@ private function copyRecord(string $srcPath, string $dstPath): void
197
219
*/
198
220
public static function getDependencies ()
199
221
{
200
- return [
201
- CopyConfigFromOldModule::class,
202
- ];
222
+ return [];
203
223
}
204
224
205
225
/**
0 commit comments