mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Merge PR #1209 branch 'dhruvgoel92/ticket/10325' into develop
# By Dhruv # Via Dhruv * dhruvgoel92/ticket/10325: [ticket/10325] move migration into a new file [ticket/10325] fix acp language [ticket/10325] use assert_response_success parts [ticket/10325] fix language in acp and ucp [ticket/10325] add assert_response_success in test [ticket/10325] functional tests for forgot password functionality [ticket/10325] add logout function in functional_test_case [ticket/10325] fix language in acp and ucp [ticket/10325] improve acp option language [ticket/10325] fix language key [ticket/10325] fix language variable [ticket/10325] change language var [ticket/10325] fix language [ticket/10325] add new config value to database [ticket/10325] trigger error if forgot password option disabled [ticket/10325] add allow forgot password option in acp
This commit is contained in:
commit
88d4964f0e
8 changed files with 100 additions and 0 deletions
|
@ -398,6 +398,7 @@ class acp_board
|
||||||
'vars' => array(
|
'vars' => array(
|
||||||
'legend1' => 'ACP_SECURITY_SETTINGS',
|
'legend1' => 'ACP_SECURITY_SETTINGS',
|
||||||
'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', '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']),
|
'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),
|
'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),
|
'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
|
28
phpBB/includes/db/migration/data/310/forgot_password.php
Normal file
28
phpBB/includes/db/migration/data/310/forgot_password.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package migration
|
||||||
|
* @copyright (c) 2012 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
class phpbb_db_migration_data_310_forgot_password extends phpbb_db_migration
|
||||||
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
return isset($this->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)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,6 +29,11 @@ class ucp_remind
|
||||||
global $config, $phpbb_root_path, $phpEx;
|
global $config, $phpbb_root_path, $phpEx;
|
||||||
global $db, $user, $auth, $template;
|
global $db, $user, $auth, $template;
|
||||||
|
|
||||||
|
if (!$config['allow_password_reset'])
|
||||||
|
{
|
||||||
|
trigger_error($user->lang('UCP_PASSWORD_RESET_DISABLED', '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'));
|
||||||
|
}
|
||||||
|
|
||||||
$username = request_var('username', '', true);
|
$username = request_var('username', '', true);
|
||||||
$email = strtolower(request_var('email', ''));
|
$email = strtolower(request_var('email', ''));
|
||||||
$submit = (isset($_POST['submit'])) ? true : false;
|
$submit = (isset($_POST['submit'])) ? true : false;
|
||||||
|
|
|
@ -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_birthdays', '1');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bookmarks', '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_emailreuse', '0');
|
||||||
|
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_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_mass_pm', '1');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_name_chars', 'USERNAME_CHARS_ANY');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_name_chars', 'USERNAME_CHARS_ANY');
|
||||||
|
|
|
@ -454,6 +454,8 @@ $lang = array_merge($lang, array(
|
||||||
'ALL' => 'All',
|
'ALL' => 'All',
|
||||||
'ALLOW_AUTOLOGIN' => 'Allow "Remember Me" logins',
|
'ALLOW_AUTOLOGIN' => 'Allow "Remember Me" logins',
|
||||||
'ALLOW_AUTOLOGIN_EXPLAIN' => 'Determines whether users are given "Remember Me" option when they visit the board.',
|
'ALLOW_AUTOLOGIN_EXPLAIN' => 'Determines whether users are given "Remember Me" option when they visit the board.',
|
||||||
|
'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' => '"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.',
|
'AUTOLOGIN_LENGTH_EXPLAIN' => 'Number of days after which "Remember Me" login keys are removed or zero to disable.',
|
||||||
'BROWSER_VALID' => 'Validate browser',
|
'BROWSER_VALID' => 'Validate browser',
|
||||||
|
|
|
@ -521,6 +521,7 @@ $lang = array_merge($lang, array(
|
||||||
'UCP_USERGROUPS_MEMBER' => 'Edit memberships',
|
'UCP_USERGROUPS_MEMBER' => 'Edit memberships',
|
||||||
'UCP_USERGROUPS_MANAGE' => 'Manage groups',
|
'UCP_USERGROUPS_MANAGE' => 'Manage groups',
|
||||||
|
|
||||||
|
'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_REGISTER_DISABLE' => 'Creating a new account is currently not possible.',
|
||||||
'UCP_REMIND' => 'Send password',
|
'UCP_REMIND' => 'Send password',
|
||||||
'UCP_RESEND' => 'Send activation email',
|
'UCP_RESEND' => 'Send activation email',
|
||||||
|
|
51
tests/functional/forgot_password_test.php
Normal file
51
tests/functional/forgot_password_test.php
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package testing
|
||||||
|
* @copyright (c) 2012 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group functional
|
||||||
|
*/
|
||||||
|
class phpbb_functional_forgot_password_test extends phpbb_functional_test_case
|
||||||
|
{
|
||||||
|
public function test_forgot_password_enabled()
|
||||||
|
{
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
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');
|
||||||
|
$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();
|
||||||
|
|
||||||
|
$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->assert_response_success();
|
||||||
|
$this->assertContains($this->lang('UCP_PASSWORD_RESET_DISABLED', '', ''), $crawler->text());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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
|
* Login to the ACP
|
||||||
* You must run login() before calling this.
|
* You must run login() before calling this.
|
||||||
|
|
Loading…
Add table
Reference in a new issue