1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-13 20:28:44 +01:00

Merge branch '3.2.x' into 3.3.x

This commit is contained in:
Marc Alexander 2019-12-06 07:20:34 +01:00
commit 3009e7ffbe
3 changed files with 65 additions and 7 deletions

View File

@ -39,7 +39,8 @@ class ucp_register
trigger_error('UCP_REGISTER_DISABLE');
}
$coppa = $request->is_set('coppa') ? (int) $request->variable('coppa', false) : false;
$coppa = $request->is_set('coppa_yes') ? 1 : ($request->is_set('coppa_no') ? 0 : false);
$coppa = $request->is_set('coppa') ? $request->variable('coppa', 0) : $coppa;
$agreed = $request->variable('agreed', false);
$submit = $request->is_set_post('submit');
$change_lang = $request->variable('change_lang', '');
@ -50,6 +51,11 @@ class ucp_register
$agreed = false;
}
if ($coppa !== false && !check_form_key('ucp_register'))
{
$coppa = false;
}
/**
* Add UCP register data before they are assigned to the template or submitted
*
@ -166,11 +172,8 @@ class ucp_register
$template_vars = array(
'S_LANG_OPTIONS' => (count($lang_row) > 1) ? language_select($user_lang) : '',
'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday),
'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday),
'U_COPPA_NO' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=0'),
'U_COPPA_YES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=1'),
'L_COPPA_NO' => $user->lang('UCP_COPPA_BEFORE', $coppa_birthday),
'L_COPPA_YES' => $user->lang('UCP_COPPA_ON_AFTER', $coppa_birthday),
'S_SHOW_COPPA' => true,
'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields),

View File

@ -43,7 +43,8 @@
<div class="inner">
<fieldset class="submit-buttons">
<!-- IF S_SHOW_COPPA -->
<strong><a href="{U_COPPA_NO}" class="button1">{L_COPPA_NO}</a></strong>&nbsp; <a href="{U_COPPA_YES}" class="button2">{L_COPPA_YES}</a>
<input type="submit" name="coppa_no" id="coppa_no" value="{{ L_COPPA_NO }}" class="button1" />
<input type="submit" name="coppa_yes" id="coppa_yes" value="{{ L_COPPA_YES }}" class="button2" />
<!-- ELSE -->
<input type="submit" name="agreed" id="agreed" value="{L_AGREE}" class="button1" />&nbsp;
<input type="submit" name="not_agreed" value="{L_NOT_AGREE}" class="button2" />

View File

@ -36,6 +36,10 @@ class phpbb_functional_registration_test extends phpbb_functional_test_case
{
$this->add_lang('ucp');
// Check that we can't skip
self::request('GET', 'ucp.php?mode=register&agreed=1');
$this->assertContainsLang('AGREE', $this->get_content());
$crawler = self::request('GET', 'ucp.php?mode=register');
$this->assertContainsLang('REGISTRATION', $crawler->filter('div.content h2')->text());
@ -64,4 +68,54 @@ class phpbb_functional_registration_test extends phpbb_functional_test_case
$this->assert_checkbox_is_checked($crawler, 'notification.type.post_notification.method.email');
$this->assert_checkbox_is_checked($crawler, 'notification.type.topic_notification.method.email');
}
/**
* @depends test_disable_captcha_on_registration
*/
public function test_register_coppa_account()
{
$this->login();
$this->admin_login();
$crawler = self::request('GET', "adm/index.php?i=acp_board&mode=registration&sid={$this->sid}");
$form = $crawler->selectButton('Submit')->form();
$form['config[coppa_enable]']->setValue('1');
$crawler = self::submit($form);
$this->assertContainsLang('CONFIG_UPDATED', $crawler->filter('#main .successbox')->text());
$this->logout();
$this->add_lang('ucp');
// Check that we can't skip
$crawler = self::request('GET', 'ucp.php?mode=register&coppa=1');
$this->assertContainsLang('COPPA_BIRTHDAY', $crawler->html());
$form = $crawler->selectButton('coppa_yes')->form();
$crawler = self::submit($form);
$this->assertContainsLang('REGISTRATION', $crawler->filter('div.content h2')->text());
$form = $crawler->selectButton('I agree to these terms')->form();
$crawler = self::submit($form);
$form = $crawler->selectButton('Submit')->form(array(
'username' => 'user-coppa-test',
'email' => 'user-coppa-test@phpbb.com',
'new_password' => 'user-coppa-testuser-coppa-test',
'password_confirm' => 'user-coppa-testuser-coppa-test',
));
$form['tz']->select('Europe/Berlin');
$crawler = self::submit($form);
$this->assertContainsLang('ACCOUNT_COPPA', $crawler->filter('#message')->text());
$this->login();
$this->admin_login();
$crawler = self::request('GET', "adm/index.php?i=acp_board&mode=registration&sid={$this->sid}");
$form = $crawler->selectButton('Submit')->form();
$form['config[coppa_enable]']->setValue('0');
$crawler = self::submit($form);
}
}