From 5de14b940e71941853d3bb279779631ae75b9b6f Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 26 Jan 2013 00:22:56 +0530 Subject: [PATCH 01/16] [ticket/10325] add allow forgot password option in acp PHPBB3-10325 --- phpBB/includes/acp/acp_board.php | 1 + phpBB/language/en/acp/board.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index bacf0d6e57..1956ade31a 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -398,6 +398,7 @@ class acp_board 'vars' => array( 'legend1' => 'ACP_SECURITY_SETTINGS', 'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_forgot_password' => array('lang' => 'ALLOW_FORGOT_PASSWORD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true), 'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index f387158a0b..4b2020b894 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -454,6 +454,8 @@ $lang = array_merge($lang, array( 'ALL' => 'All', 'ALLOW_AUTOLOGIN' => 'Allow "Remember Me" logins', 'ALLOW_AUTOLOGIN_EXPLAIN' => 'Determines whether users are given "Remember Me" option when they visit the board.', + 'ALLOW_FORGOT_PASSWORD' => 'Allow "forgot password"', + 'ALLOW_FORGOT_PASSWORD_EXPLAIN' => 'Determines whether users can use the "forgot password" option to recover their account', 'AUTOLOGIN_LENGTH' => '"Remember Me" login key expiration length (in days)', 'AUTOLOGIN_LENGTH_EXPLAIN' => 'Number of days after which "Remember Me" login keys are removed or zero to disable.', 'BROWSER_VALID' => 'Validate browser', From c6e9bd13a75441e9b35a1bfa5d2a08cc38ff1fa5 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 26 Jan 2013 01:01:57 +0530 Subject: [PATCH 02/16] [ticket/10325] trigger error if forgot password option disabled PHPBB3-10325 --- phpBB/includes/ucp/ucp_remind.php | 5 +++++ phpBB/language/en/ucp.php | 1 + 2 files changed, 6 insertions(+) diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index 8a7ba5d0ca..dd95c29def 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -29,6 +29,11 @@ class ucp_remind global $config, $phpbb_root_path, $phpEx; global $db, $user, $auth, $template; + if (!$config['allow_forgot_password']) + { + trigger_error('UCP_FORGOT_PASSWORD_DISABLE'); + } + $username = request_var('username', '', true); $email = strtolower(request_var('email', '')); $submit = (isset($_POST['submit'])) ? true : false; diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 3e090a8aec..a98dc6f11e 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -521,6 +521,7 @@ $lang = array_merge($lang, array( 'UCP_USERGROUPS_MEMBER' => 'Edit memberships', 'UCP_USERGROUPS_MANAGE' => 'Manage groups', + 'UCP_FORGOT_PASSWORD_DISABLE' => 'Function has been disabled.', 'UCP_REGISTER_DISABLE' => 'Creating a new account is currently not possible.', 'UCP_REMIND' => 'Send password', 'UCP_RESEND' => 'Send activation email', From 2dbe3b3c975d61b84310f7da27b8d525a22d1723 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 26 Jan 2013 01:09:30 +0530 Subject: [PATCH 03/16] [ticket/10325] add new config value to database PHPBB3-10325 --- phpBB/includes/db/migration/data/310/dev.php | 2 ++ phpBB/install/schemas/schema_data.sql | 1 + 2 files changed, 3 insertions(+) diff --git a/phpBB/includes/db/migration/data/310/dev.php b/phpBB/includes/db/migration/data/310/dev.php index 13b36bbf30..d3f3a341b2 100644 --- a/phpBB/includes/db/migration/data/310/dev.php +++ b/phpBB/includes/db/migration/data/310/dev.php @@ -84,6 +84,8 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration return array( array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])), + array('config.add', array('allow_forgot_password', 1)), + array('config.add', array('fulltext_postgres_ts_name', 'simple')), array('config.add', array('fulltext_postgres_min_word_len', 4)), array('config.add', array('fulltext_postgres_max_word_len', 254)), diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 8a8740a220..d9ba09ff4d 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -18,6 +18,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bbcode', '1' INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_birthdays', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bookmarks', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_emailreuse', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_forgot_password', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_forum_notify', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_mass_pm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_name_chars', 'USERNAME_CHARS_ANY'); From f8012cc239d8b442e78bbbb8a5cc5856d2a714a0 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 26 Jan 2013 11:10:17 +0530 Subject: [PATCH 04/16] [ticket/10325] fix language PHPBB3-10325 --- phpBB/includes/ucp/ucp_remind.php | 2 +- phpBB/language/en/ucp.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index dd95c29def..a25d7da91a 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -31,7 +31,7 @@ class ucp_remind if (!$config['allow_forgot_password']) { - trigger_error('UCP_FORGOT_PASSWORD_DISABLE'); + trigger_error($user->lang('UCP_FORGOT_PASSWORD_DISABLE', '', '')); } $username = request_var('username', '', true); diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index a98dc6f11e..ce93c7bcf8 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -521,7 +521,7 @@ $lang = array_merge($lang, array( 'UCP_USERGROUPS_MEMBER' => 'Edit memberships', 'UCP_USERGROUPS_MANAGE' => 'Manage groups', - 'UCP_FORGOT_PASSWORD_DISABLE' => 'Function has been disabled.', + 'UCP_FORGOT_PASSWORD_DISABLE' => 'The administrator has disabled the password reset ability. If you need help accessing your account, please contact the %sBoard Administrator%s', 'UCP_REGISTER_DISABLE' => 'Creating a new account is currently not possible.', 'UCP_REMIND' => 'Send password', 'UCP_RESEND' => 'Send activation email', From 1a51abcca293b0e2bd836af0dcb9d77054c1d401 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sun, 27 Jan 2013 03:07:52 +0530 Subject: [PATCH 05/16] [ticket/10325] change language var PHPBB3-10325 --- phpBB/includes/acp/acp_board.php | 2 +- phpBB/includes/db/migration/data/310/dev.php | 2 +- phpBB/includes/ucp/ucp_remind.php | 2 +- phpBB/install/schemas/schema_data.sql | 2 +- phpBB/language/en/acp/board.php | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 1956ade31a..ab44920f0a 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -398,7 +398,7 @@ class acp_board 'vars' => array( 'legend1' => 'ACP_SECURITY_SETTINGS', 'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'allow_forgot_password' => array('lang' => 'ALLOW_FORGOT_PASSWORD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_password_reset' => array('lang' => 'ALLOW_PASSWORD_RESET', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true), 'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), diff --git a/phpBB/includes/db/migration/data/310/dev.php b/phpBB/includes/db/migration/data/310/dev.php index d3f3a341b2..0794567f1b 100644 --- a/phpBB/includes/db/migration/data/310/dev.php +++ b/phpBB/includes/db/migration/data/310/dev.php @@ -84,7 +84,7 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration return array( array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])), - array('config.add', array('allow_forgot_password', 1)), + array('config.add', array('allow_password_reset', 1)), array('config.add', array('fulltext_postgres_ts_name', 'simple')), array('config.add', array('fulltext_postgres_min_word_len', 4)), diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index a25d7da91a..4a2d06e99a 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -29,7 +29,7 @@ class ucp_remind global $config, $phpbb_root_path, $phpEx; global $db, $user, $auth, $template; - if (!$config['allow_forgot_password']) + if (!$config['allow_password_reset']) { trigger_error($user->lang('UCP_FORGOT_PASSWORD_DISABLE', '', '')); } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index d9ba09ff4d..9690ec14b8 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -18,7 +18,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bbcode', '1' INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_birthdays', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bookmarks', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_emailreuse', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_forgot_password', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_password_reset', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_forum_notify', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_mass_pm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_name_chars', 'USERNAME_CHARS_ANY'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 4b2020b894..c0f6153788 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -454,8 +454,8 @@ $lang = array_merge($lang, array( 'ALL' => 'All', 'ALLOW_AUTOLOGIN' => 'Allow "Remember Me" logins', 'ALLOW_AUTOLOGIN_EXPLAIN' => 'Determines whether users are given "Remember Me" option when they visit the board.', - 'ALLOW_FORGOT_PASSWORD' => 'Allow "forgot password"', - 'ALLOW_FORGOT_PASSWORD_EXPLAIN' => 'Determines whether users can use the "forgot password" option to recover their account', + 'ALLOW_PASSWORD_RESET' => 'Allow "forgot password"', + 'ALLOW_PASSWORD_RESET_EXPLAIN' => 'Determines whether users can use the "forgot password" option to recover their account', 'AUTOLOGIN_LENGTH' => '"Remember Me" login key expiration length (in days)', 'AUTOLOGIN_LENGTH_EXPLAIN' => 'Number of days after which "Remember Me" login keys are removed or zero to disable.', 'BROWSER_VALID' => 'Validate browser', From f1e615c4297a509325b764e1966118fe171ebbb5 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sun, 27 Jan 2013 03:09:52 +0530 Subject: [PATCH 06/16] [ticket/10325] fix language variable PHPBB3-10325 --- phpBB/includes/ucp/ucp_remind.php | 2 +- phpBB/language/en/ucp.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index 4a2d06e99a..cd4d13c8a7 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -31,7 +31,7 @@ class ucp_remind if (!$config['allow_password_reset']) { - trigger_error($user->lang('UCP_FORGOT_PASSWORD_DISABLE', '', '')); + trigger_error($user->lang('UCP_FORGOT_PASSWORD_DISABLED', '', '')); } $username = request_var('username', '', true); diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index ce93c7bcf8..3864414af0 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -521,7 +521,7 @@ $lang = array_merge($lang, array( 'UCP_USERGROUPS_MEMBER' => 'Edit memberships', 'UCP_USERGROUPS_MANAGE' => 'Manage groups', - 'UCP_FORGOT_PASSWORD_DISABLE' => 'The administrator has disabled the password reset ability. If you need help accessing your account, please contact the %sBoard Administrator%s', + 'UCP_FORGOT_PASSWORD_DISABLED' => 'The administrator has disabled the password reset ability. If you need help accessing your account, please contact the %sBoard Administrator%s', 'UCP_REGISTER_DISABLE' => 'Creating a new account is currently not possible.', 'UCP_REMIND' => 'Send password', 'UCP_RESEND' => 'Send activation email', From c048067bbd45b51595cc243cc4edde1d84eda405 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sun, 27 Jan 2013 11:27:28 +0530 Subject: [PATCH 07/16] [ticket/10325] fix language key PHPBB3-10325 --- phpBB/includes/ucp/ucp_remind.php | 2 +- phpBB/language/en/ucp.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index cd4d13c8a7..ff7ab53736 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -31,7 +31,7 @@ class ucp_remind if (!$config['allow_password_reset']) { - trigger_error($user->lang('UCP_FORGOT_PASSWORD_DISABLED', '', '')); + trigger_error($user->lang('UCP_PASSWORD_RESET_DISABLED', '', '')); } $username = request_var('username', '', true); diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 3864414af0..920dfaf176 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -521,7 +521,7 @@ $lang = array_merge($lang, array( 'UCP_USERGROUPS_MEMBER' => 'Edit memberships', 'UCP_USERGROUPS_MANAGE' => 'Manage groups', - 'UCP_FORGOT_PASSWORD_DISABLED' => 'The administrator has disabled the password reset ability. If you need help accessing your account, please contact the %sBoard Administrator%s', + 'UCP_PASSWORD_RESET_DISABLED' => 'The administrator has disabled the password reset ability. If you need help accessing your account, please contact the %sBoard Administrator%s', 'UCP_REGISTER_DISABLE' => 'Creating a new account is currently not possible.', 'UCP_REMIND' => 'Send password', 'UCP_RESEND' => 'Send activation email', From 419aaa402f025d16e8b823586e32917d1d036599 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 28 Jan 2013 01:05:04 +0530 Subject: [PATCH 08/16] [ticket/10325] improve acp option language PHPBB3-10325 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index c0f6153788..c084779a26 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -455,7 +455,7 @@ $lang = array_merge($lang, array( 'ALLOW_AUTOLOGIN' => 'Allow "Remember Me" logins', 'ALLOW_AUTOLOGIN_EXPLAIN' => 'Determines whether users are given "Remember Me" option when they visit the board.', 'ALLOW_PASSWORD_RESET' => 'Allow "forgot password"', - 'ALLOW_PASSWORD_RESET_EXPLAIN' => 'Determines whether users can use the "forgot password" option to recover their account', + 'ALLOW_PASSWORD_RESET_EXPLAIN' => 'Determines whether or not users are able to use the "I forgot my password" link on the login page to recover their account. This feature can be disabled when using an external authentication plugin.', 'AUTOLOGIN_LENGTH' => '"Remember Me" login key expiration length (in days)', 'AUTOLOGIN_LENGTH_EXPLAIN' => 'Number of days after which "Remember Me" login keys are removed or zero to disable.', 'BROWSER_VALID' => 'Validate browser', From d242b7a1a5c9b6ecc8bc21027a33bc344501a0ce Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 25 Apr 2013 21:05:02 +0530 Subject: [PATCH 09/16] [ticket/10325] fix language in acp and ucp PHPBB3-10325 --- phpBB/language/en/acp/board.php | 2 +- phpBB/language/en/ucp.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index c084779a26..39ad5b78bb 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -455,7 +455,7 @@ $lang = array_merge($lang, array( 'ALLOW_AUTOLOGIN' => 'Allow "Remember Me" logins', 'ALLOW_AUTOLOGIN_EXPLAIN' => 'Determines whether users are given "Remember Me" option when they visit the board.', 'ALLOW_PASSWORD_RESET' => 'Allow "forgot password"', - 'ALLOW_PASSWORD_RESET_EXPLAIN' => 'Determines whether or not users are able to use the "I forgot my password" link on the login page to recover their account. This feature can be disabled when using an external authentication plugin.', + 'ALLOW_PASSWORD_RESET_EXPLAIN' => 'Determines whether or not users are able to use the "I forgot my password" link on the login page to recover their account. If you use an external authentication mechanism you may wish to disable this feature.', 'AUTOLOGIN_LENGTH' => '"Remember Me" login key expiration length (in days)', 'AUTOLOGIN_LENGTH_EXPLAIN' => 'Number of days after which "Remember Me" login keys are removed or zero to disable.', 'BROWSER_VALID' => 'Validate browser', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 920dfaf176..372e44a94d 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -521,7 +521,7 @@ $lang = array_merge($lang, array( 'UCP_USERGROUPS_MEMBER' => 'Edit memberships', 'UCP_USERGROUPS_MANAGE' => 'Manage groups', - 'UCP_PASSWORD_RESET_DISABLED' => 'The administrator has disabled the password reset ability. If you need help accessing your account, please contact the %sBoard Administrator%s', + 'UCP_PASSWORD_RESET_DISABLED' => 'The administrator has disabled the password reset functionality. If you need help accessing your account, please contact the %sBoard Administrator%s', 'UCP_REGISTER_DISABLE' => 'Creating a new account is currently not possible.', 'UCP_REMIND' => 'Send password', 'UCP_RESEND' => 'Send activation email', From 2fa5f9591e06e82ca76e7ac7e653d8ad4494eb67 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 25 Apr 2013 22:52:40 +0530 Subject: [PATCH 10/16] [ticket/10325] add logout function in functional_test_case PHPBB3-10325 --- tests/test_framework/phpbb_functional_test_case.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 5534de89c9..dae37f336d 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -425,6 +425,17 @@ class phpbb_functional_test_case extends phpbb_test_case } } + protected function logout() + { + $this->add_lang('ucp'); + + $crawler = $this->request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout'); + $this->assert_response_success(); + $this->assertContains($this->lang('LOGOUT_REDIRECT'), $crawler->filter('#message')->text()); + unset($this->sid); + + } + /** * Login to the ACP * You must run login() before calling this. From 27aa5e7b713b58eb0afb8d92e684a6868eb080ce Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 25 Apr 2013 22:58:03 +0530 Subject: [PATCH 11/16] [ticket/10325] functional tests for forgot password functionality PHPBB3-10325 --- tests/functional/forgot_password_test.php | 45 +++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/functional/forgot_password_test.php diff --git a/tests/functional/forgot_password_test.php b/tests/functional/forgot_password_test.php new file mode 100644 index 0000000000..3ae74ed1e9 --- /dev/null +++ b/tests/functional/forgot_password_test.php @@ -0,0 +1,45 @@ +add_lang('ucp'); + $crawler = $this->request('GET', 'ucp.php?mode=sendpassword'); + $this->assertEquals($this->lang('SEND_PASSWORD'), $crawler->filter('h2')->text()); + } + + public function test_forgot_password_disabled() + { + $this->login(); + $this->admin_login(); + $this->add_lang('ucp'); + $crawler = $this->request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=security'); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + + $values["config[allow_password_reset]"] = 0; + $form->setValues($values); + $crawler = $this->client->submit($form); + + $this->logout(); + + $crawler = $this->request('GET', 'ucp.php?mode=sendpassword'); + + $this->assertContains($this->lang('UCP_PASSWORD_RESET_DISABLED', '', ''), $crawler->text()); + + } + +} From a5b5e4b31da6f91e73b09b3c2a50d1a79e8c108d Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 30 Apr 2013 22:29:20 +0530 Subject: [PATCH 12/16] [ticket/10325] add assert_response_success in test PHPBB3-10325 --- tests/functional/forgot_password_test.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/functional/forgot_password_test.php b/tests/functional/forgot_password_test.php index 3ae74ed1e9..14dfae3d7c 100644 --- a/tests/functional/forgot_password_test.php +++ b/tests/functional/forgot_password_test.php @@ -17,6 +17,7 @@ class phpbb_functional_forgot_password_test extends phpbb_functional_test_case global $config; $this->add_lang('ucp'); $crawler = $this->request('GET', 'ucp.php?mode=sendpassword'); + $this->assert_response_success(); $this->assertEquals($this->lang('SEND_PASSWORD'), $crawler->filter('h2')->text()); } @@ -26,6 +27,7 @@ class phpbb_functional_forgot_password_test extends phpbb_functional_test_case $this->admin_login(); $this->add_lang('ucp'); $crawler = $this->request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=security'); + //$this->assert_response_success(); $form = $crawler->selectButton('Submit')->form(); $values = $form->getValues(); @@ -37,7 +39,7 @@ class phpbb_functional_forgot_password_test extends phpbb_functional_test_case $this->logout(); $crawler = $this->request('GET', 'ucp.php?mode=sendpassword'); - + $this->assert_response_success(); $this->assertContains($this->lang('UCP_PASSWORD_RESET_DISABLED', '', ''), $crawler->text()); } From a90a0b087ca3b1e29561a08019ca8ba2fa21c19d Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 30 Apr 2013 22:59:32 +0530 Subject: [PATCH 13/16] [ticket/10325] fix language in acp and ucp PHPBB3-10325 --- phpBB/language/en/acp/board.php | 2 +- phpBB/language/en/ucp.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 39ad5b78bb..1bc8d1cf46 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -454,7 +454,7 @@ $lang = array_merge($lang, array( 'ALL' => 'All', 'ALLOW_AUTOLOGIN' => 'Allow "Remember Me" logins', 'ALLOW_AUTOLOGIN_EXPLAIN' => 'Determines whether users are given "Remember Me" option when they visit the board.', - 'ALLOW_PASSWORD_RESET' => 'Allow "forgot password"', + 'ALLOW_PASSWORD_RESET' => 'Allow "Forgot Password"', 'ALLOW_PASSWORD_RESET_EXPLAIN' => 'Determines whether or not users are able to use the "I forgot my password" link on the login page to recover their account. If you use an external authentication mechanism you may wish to disable this feature.', 'AUTOLOGIN_LENGTH' => '"Remember Me" login key expiration length (in days)', 'AUTOLOGIN_LENGTH_EXPLAIN' => 'Number of days after which "Remember Me" login keys are removed or zero to disable.', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 372e44a94d..a91b6b84d5 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -521,7 +521,7 @@ $lang = array_merge($lang, array( 'UCP_USERGROUPS_MEMBER' => 'Edit memberships', 'UCP_USERGROUPS_MANAGE' => 'Manage groups', - 'UCP_PASSWORD_RESET_DISABLED' => 'The administrator has disabled the password reset functionality. If you need help accessing your account, please contact the %sBoard Administrator%s', + 'UCP_PASSWORD_RESET_DISABLED' => 'The password reset functionality has been disabled. If you need help accessing your account, please contact the %sBoard Administrator%s', 'UCP_REGISTER_DISABLE' => 'Creating a new account is currently not possible.', 'UCP_REMIND' => 'Send password', 'UCP_RESEND' => 'Send activation email', From 1d0c8a1fe86b65174ae27c2353d52b69fda2a16d Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 30 Apr 2013 23:09:28 +0530 Subject: [PATCH 14/16] [ticket/10325] use assert_response_success parts PHPBB3-10325 --- tests/functional/forgot_password_test.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/functional/forgot_password_test.php b/tests/functional/forgot_password_test.php index 14dfae3d7c..bfb4616d64 100644 --- a/tests/functional/forgot_password_test.php +++ b/tests/functional/forgot_password_test.php @@ -27,7 +27,11 @@ class phpbb_functional_forgot_password_test extends phpbb_functional_test_case $this->admin_login(); $this->add_lang('ucp'); $crawler = $this->request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=security'); - //$this->assert_response_success(); + $this->assertEquals(200, $this->client->getResponse()->getStatus()); + $content = $this->client->getResponse()->getContent(); + $this->assertNotContains('Fatal error:', $content); + $this->assertNotContains('Notice:', $content); + $this->assertNotContains('[phpBB Debug]', $content); $form = $crawler->selectButton('Submit')->form(); $values = $form->getValues(); From 00d5cde04eb56b53179385c3ada075b1c207c3a3 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 4 May 2013 14:44:33 +0530 Subject: [PATCH 15/16] [ticket/10325] fix acp language PHPBB3-10325 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 1bc8d1cf46..ce15dfefb4 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -454,7 +454,7 @@ $lang = array_merge($lang, array( 'ALL' => 'All', 'ALLOW_AUTOLOGIN' => 'Allow "Remember Me" logins', 'ALLOW_AUTOLOGIN_EXPLAIN' => 'Determines whether users are given "Remember Me" option when they visit the board.', - 'ALLOW_PASSWORD_RESET' => 'Allow "Forgot Password"', + 'ALLOW_PASSWORD_RESET' => 'Allow password reset ("Forgot Password")', 'ALLOW_PASSWORD_RESET_EXPLAIN' => 'Determines whether or not users are able to use the "I forgot my password" link on the login page to recover their account. If you use an external authentication mechanism you may wish to disable this feature.', 'AUTOLOGIN_LENGTH' => '"Remember Me" login key expiration length (in days)', 'AUTOLOGIN_LENGTH_EXPLAIN' => 'Number of days after which "Remember Me" login keys are removed or zero to disable.', From 284011ebf256bffb9544493c7b82f90eeff4ae39 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 8 May 2013 17:04:03 +0530 Subject: [PATCH 16/16] [ticket/10325] move migration into a new file PHPBB3-10325 --- phpBB/includes/db/migration/data/310/dev.php | 2 -- .../db/migration/data/310/forgot_password.php | 28 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 phpBB/includes/db/migration/data/310/forgot_password.php diff --git a/phpBB/includes/db/migration/data/310/dev.php b/phpBB/includes/db/migration/data/310/dev.php index 0794567f1b..13b36bbf30 100644 --- a/phpBB/includes/db/migration/data/310/dev.php +++ b/phpBB/includes/db/migration/data/310/dev.php @@ -84,8 +84,6 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration return array( array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])), - array('config.add', array('allow_password_reset', 1)), - array('config.add', array('fulltext_postgres_ts_name', 'simple')), array('config.add', array('fulltext_postgres_min_word_len', 4)), array('config.add', array('fulltext_postgres_max_word_len', 254)), diff --git a/phpBB/includes/db/migration/data/310/forgot_password.php b/phpBB/includes/db/migration/data/310/forgot_password.php new file mode 100644 index 0000000000..a553e51f35 --- /dev/null +++ b/phpBB/includes/db/migration/data/310/forgot_password.php @@ -0,0 +1,28 @@ +config['allow_password_reset']); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_11'); + } + + public function update_data() + { + return array( + array('config.add', array('allow_password_reset', 1)), + ); + } +}