[ticket/16211] Use form to ensure link data is passed on coppa registration

PHPBB3-16211
This commit is contained in:
Marc Alexander 2019-11-27 22:01:26 +01:00
parent 7b428641f0
commit 417271f573
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
2 changed files with 7 additions and 11 deletions

View file

@ -39,8 +39,8 @@ class ucp_register
trigger_error('UCP_REGISTER_DISABLE'); 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);
$token = $request->variable('hash', ''); $coppa = $request->is_set('coppa') ? $request->variable('coppa', 0) : $coppa;
$agreed = $request->variable('agreed', false); $agreed = $request->variable('agreed', false);
$submit = $request->is_set_post('submit'); $submit = $request->is_set_post('submit');
$change_lang = $request->variable('change_lang', ''); $change_lang = $request->variable('change_lang', '');
@ -51,7 +51,7 @@ class ucp_register
$agreed = false; $agreed = false;
} }
if ($coppa !== false && !check_link_hash($token, 'coppa') && !check_form_key('ucp_register')) if ($coppa !== false && !check_form_key('ucp_register'))
{ {
$coppa = false; $coppa = false;
} }
@ -170,15 +170,10 @@ class ucp_register
->format($user->lang['DATE_FORMAT'], true); ->format($user->lang['DATE_FORMAT'], true);
unset($now); unset($now);
$coppa_link_hash = '&hash=' . generate_link_hash('coppa');
$template_vars = array( $template_vars = array(
'S_LANG_OPTIONS' => (count($lang_row) > 1) ? language_select($user_lang) : '', 'S_LANG_OPTIONS' => (count($lang_row) > 1) ? language_select($user_lang) : '',
'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), 'L_COPPA_NO' => $user->lang('UCP_COPPA_BEFORE', $coppa_birthday),
'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), 'L_COPPA_YES' => $user->lang('UCP_COPPA_ON_AFTER', $coppa_birthday),
'U_COPPA_NO' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=0' . $coppa_link_hash),
'U_COPPA_YES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=1' . $coppa_link_hash),
'S_SHOW_COPPA' => true, 'S_SHOW_COPPA' => true,
'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields),

View file

@ -43,7 +43,8 @@
<div class="inner"> <div class="inner">
<fieldset class="submit-buttons"> <fieldset class="submit-buttons">
<!-- IF S_SHOW_COPPA --> <!-- 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 --> <!-- ELSE -->
<input type="submit" name="agreed" id="agreed" value="{L_AGREE}" class="button1" />&nbsp; <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" /> <input type="submit" name="not_agreed" value="{L_NOT_AGREE}" class="button2" />