Skip to content

Commit 5a385cb

Browse files
authored
Merge pull request #2054 from Admidio/sumarize-captcha-preferences
Summarize captcha enabling settings
2 parents e445f62 + a52fdc6 commit 5a385cb

9 files changed

Lines changed: 15 additions & 20 deletions

File tree

install/db_scripts/preferences.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454

5555
// Registration
5656
'registration_adopt_all_data' => '1',
57-
'registration_enable_captcha' => '1',
5857
'registration_module_enabled' => '1',
5958
'registration_manual_approval' => '1',
6059
'registration_send_notification_email' => '1',
@@ -124,6 +123,7 @@
124123
'system_notifications_inventory_changes' => '0',
125124

126125
// Captcha
126+
'captcha_enabled' => '1',
127127
'captcha_type' => 'pic',
128128
'captcha_fonts' => 'AHGBold.ttf',
129129
'captcha_width' => '215',
@@ -209,7 +209,6 @@
209209
// Messages
210210
'mail_module_enabled' => '1',
211211
'pm_module_enabled' => '1',
212-
'mail_captcha_enabled' => '1',
213212
'mail_delivery_confirmation' => '0',
214213
'mail_html_registered_users' => '1',
215214
'mail_max_receiver' => '10',

install/db_scripts/update_5_1.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,9 @@
4848
<step id="430" database="mysql">UPDATE %PREFIX%_preferences pr1 INNER JOIN %PREFIX%_preferences pr2 ON pr2.prf_name = 'additional_styles_file' AND pr2.prf_org_id = pr1.prf_org_id SET pr1.prf_value = pr2.prf_value WHERE pr1.prf_name = 'theme_additional_styles_file'</step>
4949
<step id="440" database="pgsql">UPDATE %PREFIX%_preferences pr1 SET prf_value = pr2.prf_value FROM %PREFIX%_preferences pr2 WHERE pr2.prf_name = 'additional_styles_file' AND pr2.prf_org_id = pr1.prf_org_id AND pr1.prf_name = 'theme_additional_styles_file'</step>
5050
<step id="450">DELETE FROM %PREFIX%_preferences WHERE prf_name = 'additional_styles_file'</step>
51+
<step id="460" database="mysql">UPDATE %PREFIX%_preferences pr1 INNER JOIN %PREFIX%_preferences pr2 ON pr2.prf_name = 'mail_captcha_enabled' AND pr2.prf_org_id = pr1.prf_org_id SET pr1.prf_value = pr2.prf_value WHERE pr1.prf_name = 'captcha_enabled'</step>
52+
<step id="470" database="pgsql">UPDATE %PREFIX%_preferences pr1 SET prf_value = pr2.prf_value FROM %PREFIX%_preferences pr2 WHERE pr2.prf_name = 'mail_captcha_enabled' AND pr2.prf_org_id = pr1.prf_org_id AND pr1.prf_name = 'captcha_enabled'</step>
53+
<step id="480">DELETE FROM %PREFIX%_preferences WHERE prf_name = 'mail_captcha_enabled'</step>
54+
<step id="490">DELETE FROM %PREFIX%_preferences WHERE prf_name = 'registration_enable_captcha'</step>
5155
<step>stop</step>
5256
</update>

modules/messages/messages_write.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@
601601
}
602602

603603
// if captchas are enabled then visitors of the website must resolve this
604-
if (!$gValidLogin && $gSettingsManager->getBool('mail_captcha_enabled')) {
604+
if (!$gValidLogin && $gSettingsManager->getBool('captcha_enabled')) {
605605
$form->addCaptcha('adm_captcha_code');
606606
}
607607

modules/profile/profile_new.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@
382382
}
383383

384384
// if captchas are enabled, then visitors of the website must resolve this
385-
if (!$gValidLogin && $gSettingsManager->getBool('registration_enable_captcha')) {
385+
if (!$gValidLogin && $gSettingsManager->getBool('captcha_enabled')) {
386386
$form->addCaptcha('adm_captcha_code');
387387
}
388388

src/UI/Presenter/PreferencesPresenter.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@ public function createCaptchaForm(): string
292292
array('class' => 'form-preferences')
293293
);
294294

295+
$formCaptcha->addCheckbox(
296+
'captcha_enabled',
297+
$gL10n->get('ORG_ENABLE_CAPTCHA'),
298+
(bool) $formValues['captcha_enabled'],
299+
array('helpTextId' => 'SYS_SHOW_CAPTCHA_DESC')
300+
);
295301
// search all available themes in the theme folder
296302
$themes = array_keys(FileSystemUtils::getDirectoryContent(ADMIDIO_PATH . FOLDER_THEMES, false, false, array(FileSystemUtils::CONTENT_TYPE_DIRECTORY)));
297303
if (count($themes) === 0) {
@@ -1762,13 +1768,6 @@ public function createMessagesForm(): string
17621768
(bool) $formValues['pm_module_enabled'],
17631769
array('helpTextId' => 'SYS_ENABLE_PM_MODULE_DESC')
17641770
);
1765-
$formMessages->addCheckbox(
1766-
'mail_captcha_enabled',
1767-
$gL10n->get('ORG_ENABLE_CAPTCHA'),
1768-
(bool) $formValues['mail_captcha_enabled'],
1769-
array('helpTextId' => 'SYS_SHOW_CAPTCHA_DESC')
1770-
);
1771-
17721771
$formMessages->addSelectBox(
17731772
'mail_template',
17741773
$gL10n->get('SYS_EMAIL_TEMPLATE'),
@@ -2153,12 +2152,6 @@ public function createRegistrationForm(): string
21532152
(bool) $formValues['registration_manual_approval'],
21542153
array('helpTextId' => array('SYS_MANUAL_APPROVAL_DESC', array('SYS_RIGHT_APPROVE_USERS')))
21552154
);
2156-
$formRegistration->addCheckbox(
2157-
'registration_enable_captcha',
2158-
$gL10n->get('ORG_ENABLE_CAPTCHA'),
2159-
(bool) $formValues['registration_enable_captcha'],
2160-
array('helpTextId' => 'ORG_CAPTCHA_REGISTRATION')
2161-
);
21622155
$formRegistration->addCheckbox(
21632156
'registration_adopt_all_data',
21642157
$gL10n->get('SYS_REGISTRATION_ADOPT_ALL_DATA'),

system/password_reset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@
285285
);
286286

287287
// if captchas are enabled, then visitors of the website must resolve this
288-
if (!$gValidLogin && $gSettingsManager->getBool('mail_captcha_enabled')) {
288+
if (!$gValidLogin && $gSettingsManager->getBool('captcha_enabled')) {
289289
$form->addCaptcha('adm_captcha_code');
290290
}
291291

themes/simple/templates/preferences/preferences.captcha.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{/foreach}>
44

55
{include 'sys-template-parts/form.input.tpl' data=$elements['adm_csrf_token']}
6+
{include 'sys-template-parts/form.checkbox.tpl' data=$elements['captcha_enabled']}
67
{include 'sys-template-parts/form.select.tpl' data=$elements['captcha_type']}
78
{include 'sys-template-parts/form.select.tpl' data=$elements['captcha_fonts']}
89
{include 'sys-template-parts/form.input.tpl' data=$elements['captcha_width']}

themes/simple/templates/preferences/preferences.messages.tpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
{include 'sys-template-parts/form.input.tpl' data=$elements['adm_csrf_token']}
66
{include 'sys-template-parts/form.select.tpl' data=$elements['mail_module_enabled']}
77
{include 'sys-template-parts/form.checkbox.tpl' data=$elements['pm_module_enabled']}
8-
{include 'sys-template-parts/form.checkbox.tpl' data=$elements['mail_captcha_enabled']}
98
{include 'sys-template-parts/form.select.tpl' data=$elements['mail_template']}
109
{include 'sys-template-parts/form.input.tpl' data=$elements['mail_max_receiver']}
1110
{include 'sys-template-parts/form.checkbox.tpl' data=$elements['mail_show_former']}

themes/simple/templates/preferences/preferences.registration.tpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
{include 'sys-template-parts/form.input.tpl' data=$elements['adm_csrf_token']}
66
{include 'sys-template-parts/form.checkbox.tpl' data=$elements['registration_module_enabled']}
77
{include 'sys-template-parts/form.checkbox.tpl' data=$elements['registration_manual_approval']}
8-
{include 'sys-template-parts/form.checkbox.tpl' data=$elements['registration_enable_captcha']}
98
{include 'sys-template-parts/form.checkbox.tpl' data=$elements['registration_adopt_all_data']}
109
{include 'sys-template-parts/form.checkbox.tpl' data=$elements['registration_send_notification_email']}
1110
{include 'sys-template-parts/form.button.tpl' data=$elements['adm_button_save_registration']}

0 commit comments

Comments
 (0)