From d5f411a16d9245cdb93d81db26d3ade1e4787b28 Mon Sep 17 00:00:00 2001 From: rxu Date: Fri, 5 May 2023 23:31:01 +0700 Subject: [PATCH] [ticket/17135] Remove SMTP auth method option Symfony Mailer handles SMTP auth method internally. PHPBB3-17135 --- phpBB/docs/install-config.sample.yml | 1 - phpBB/includes/acp/acp_board.php | 25 ------------ .../includes/questionnaire/questionnaire.php | 1 - phpBB/install/schemas/schema_data.sql | 1 - phpBB/language/en/acp/board.php | 7 ---- .../data/v400/remove_smtp_auth_method.php | 38 +++++++++++++++++++ .../console/command/install/install.php | 1 - .../phpbb/install/installer_configuration.php | 3 -- .../task/add_config_settings.php | 1 - .../obtain_data/task/obtain_email_data.php | 20 ---------- .../phpbb_functional_test_case.php | 1 - vagrant/phpbb-install-config.yml | 1 - 12 files changed, 38 insertions(+), 62 deletions(-) create mode 100644 phpBB/phpbb/db/migration/data/v400/remove_smtp_auth_method.php diff --git a/phpBB/docs/install-config.sample.yml b/phpBB/docs/install-config.sample.yml index a354e52e2f..5ef6c643be 100644 --- a/phpBB/docs/install-config.sample.yml +++ b/phpBB/docs/install-config.sample.yml @@ -23,7 +23,6 @@ installer: smtp_delivery : ~ smtp_host: ~ smtp_port: ~ - smtp_auth: ~ smtp_user: ~ smtp_pass: ~ diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index bda5661278..2afa79b1e6 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -473,7 +473,6 @@ class acp_board 'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'smtp_host' => array('lang' => 'SMTP_SERVER', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), 'smtp_port' => array('lang' => 'SMTP_PORT', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), - 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true), 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true), 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true), 'smtp_verify_peer' => array('lang' => 'SMTP_VERIFY_PEER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), @@ -884,30 +883,6 @@ class acp_board ]; } - /** - * Select mail authentication method - */ - function mail_auth_select($selected_method, $key = '') - { - global $user; - - $auth_methods = ['PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP']; - $s_smtp_auth_options = []; - - foreach ($auth_methods as $method) - { - $s_smtp_auth_options[] = [ - 'value' => $method, - 'selected' => $selected_method == $method, - 'label' => $user->lang('SMTP_' . str_replace('-', '_', $method)), - ]; - } - - return [ - 'options' => $s_smtp_auth_options, - ]; - } - /** * Select full folder action */ diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 74675e0e03..319537f3e3 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -435,7 +435,6 @@ class phpbb_questionnaire_phpbb_data_provider 'secure_downloads' => true, 'session_gc' => true, 'session_length' => true, - 'smtp_auth_method' => true, 'smtp_delivery' => true, 'topics_per_page' => true, 'version' => true, diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 21b26ee9c8..43b8f95fc8 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -287,7 +287,6 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('sitename_short', ' INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_path', 'images/smilies'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_per_page', '50'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_allow_self_signed', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_auth_method', 'PLAIN'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_port', '25'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 633df91138..e46091c954 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -553,15 +553,8 @@ $lang = array_merge($lang, array( 'SEND_TEST_EMAIL_EXPLAIN' => 'This will send a test email to the address defined in your account.', 'SMTP_ALLOW_SELF_SIGNED' => 'Allow self-signed SSL certificates', 'SMTP_ALLOW_SELF_SIGNED_EXPLAIN'=> 'Allow connections to SMTP server with self-signed SSL certificate.
Warning: Allowing self-signed SSL certificates may cause security implications.', - 'SMTP_AUTH_METHOD' => 'Authentication method for SMTP', - 'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.', - 'SMTP_CRAM_MD5' => 'CRAM-MD5', - 'SMTP_DIGEST_MD5' => 'DIGEST-MD5', - 'SMTP_LOGIN' => 'LOGIN', 'SMTP_PASSWORD' => 'SMTP password', 'SMTP_PASSWORD_EXPLAIN' => 'Only enter a password if your SMTP server requires it.
Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', - 'SMTP_PLAIN' => 'PLAIN', - 'SMTP_POP_BEFORE_SMTP' => 'POP-BEFORE-SMTP', 'SMTP_PORT' => 'SMTP server port', 'SMTP_PORT_EXPLAIN' => 'Only change this if you know your SMTP server is on a different port.', 'SMTP_SERVER' => 'SMTP server address', diff --git a/phpBB/phpbb/db/migration/data/v400/remove_smtp_auth_method.php b/phpBB/phpbb/db/migration/data/v400/remove_smtp_auth_method.php new file mode 100644 index 0000000000..eed17067b7 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v400/remove_smtp_auth_method.php @@ -0,0 +1,38 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v400; + +use phpbb\db\migration\migration; + +class remove_smtp_auth_method extends migration +{ + public function effectively_installed() + { + return !$this->config->offsetExists('smtp_auth_method'); + } + + public static function depends_on() + { + return [ + '\phpbb\db\migration\data\v400\dev', + ]; + } + + public function update_data() + { + return [ + ['config.remove', ['smtp_auth_method']], + ]; + } +} diff --git a/phpBB/phpbb/install/console/command/install/install.php b/phpBB/phpbb/install/console/command/install/install.php index 84c8aa688a..6641f9b944 100644 --- a/phpBB/phpbb/install/console/command/install/install.php +++ b/phpBB/phpbb/install/console/command/install/install.php @@ -195,7 +195,6 @@ class install extends \phpbb\console\command\command $iohandler->set_input('smtp_delivery', $config['email']['smtp_delivery']); $iohandler->set_input('smtp_host', $config['email']['smtp_host']); $iohandler->set_input('smtp_port', $config['email']['smtp_port']); - $iohandler->set_input('smtp_auth', $config['email']['smtp_auth']); $iohandler->set_input('smtp_user', $config['email']['smtp_user']); $iohandler->set_input('smtp_pass', $config['email']['smtp_pass']); $iohandler->set_input('submit_email', 'submit'); diff --git a/phpBB/phpbb/install/installer_configuration.php b/phpBB/phpbb/install/installer_configuration.php index 974080dc55..f1051095e2 100644 --- a/phpBB/phpbb/install/installer_configuration.php +++ b/phpBB/phpbb/install/installer_configuration.php @@ -97,9 +97,6 @@ class installer_configuration implements ConfigurationInterface ->scalarNode('smtp_port') ->defaultValue(null) ->end() - ->scalarNode('smtp_auth') - ->defaultValue(null) - ->end() ->scalarNode('smtp_user') ->defaultValue(null) ->end() diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php index 5b9a9da536..14c88a04d3 100644 --- a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php +++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php @@ -150,7 +150,6 @@ class add_config_settings extends database_task 'smtp_delivery' => $this->install_config->get('smtp_delivery'), 'smtp_host' => $this->install_config->get('smtp_host'), 'smtp_port' => $this->install_config->get('smtp_port'), - 'smtp_auth_method' => $this->install_config->get('smtp_auth'), 'smtp_username' => $this->install_config->get('smtp_user'), 'smtp_password' => $this->install_config->get('smtp_pass'), diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_email_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_email_data.php index 93c0eb385e..3c6508f6a7 100644 --- a/phpBB/phpbb/install/module/obtain_data/task/obtain_email_data.php +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_email_data.php @@ -52,12 +52,9 @@ class obtain_email_data extends \phpbb\install\task_base implements \phpbb\insta $smtp_delivery = $this->io_handler->get_input('smtp_delivery', ''); $smtp_host = $this->io_handler->get_input('smtp_host', '', true); $smtp_port = $this->io_handler->get_input('smtp_port', ''); - $smtp_auth = $this->io_handler->get_input('smtp_auth', ''); $smtp_user = $this->io_handler->get_input('smtp_user', '', true); $smtp_passwd = $this->io_handler->get_input('smtp_pass', '', true); - $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); - // Check if data is sent if ($this->io_handler->get_input('submit_email', false)) { @@ -65,22 +62,11 @@ class obtain_email_data extends \phpbb\install\task_base implements \phpbb\insta $this->install_config->set('smtp_delivery', $smtp_delivery); $this->install_config->set('smtp_host', $smtp_host); $this->install_config->set('smtp_port', $smtp_port); - $this->install_config->set('smtp_auth', $smtp_auth); $this->install_config->set('smtp_user', $smtp_user); $this->install_config->set('smtp_pass', $smtp_passwd); } else { - $auth_options = array(); - foreach ($auth_methods as $method) - { - $auth_options[] = array( - 'value' => $method, - 'label' => 'SMTP_' . str_replace('-', '_', $method), - 'selected' => false, - ); - } - $email_form = array( 'email_enable' => array( 'label' => 'ENABLE_EMAIL', @@ -126,12 +112,6 @@ class obtain_email_data extends \phpbb\install\task_base implements \phpbb\insta 'type' => 'text', 'default' => $smtp_port, ), - 'smtp_auth' => array( - 'label' => 'SMTP_AUTH_METHOD', - 'description' => 'SMTP_AUTH_METHOD_EXPLAIN', - 'type' => 'select', - 'options' => $auth_options, - ), 'smtp_user' => array( 'label' => 'SMTP_USERNAME', 'description' => 'SMTP_USERNAME_EXPLAIN', diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index ddfca1e0be..3e9b654b0e 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -419,7 +419,6 @@ class phpbb_functional_test_case extends phpbb_test_case $iohandler->set_input('email_enable', true); $iohandler->set_input('smtp_delivery', '1'); $iohandler->set_input('smtp_host', ''); - $iohandler->set_input('smtp_auth', 'PLAIN'); $iohandler->set_input('smtp_user', 'nxuser'); $iohandler->set_input('smtp_pass', 'nxpass'); $iohandler->set_input('submit_email', 'submit'); diff --git a/vagrant/phpbb-install-config.yml b/vagrant/phpbb-install-config.yml index db7b525b9f..0b89958299 100644 --- a/vagrant/phpbb-install-config.yml +++ b/vagrant/phpbb-install-config.yml @@ -38,7 +38,6 @@ installer: enabled: false smtp_delivery : ~ smtp_host: ~ - smtp_auth: ~ smtp_user: ~ smtp_pass: ~