mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Merge pull request #6256 from marc1706/ticket/16825
[ticket/16825] Adjust handling of session ID when requiring cookies
This commit is contained in:
commit
49b01d05c1
13 changed files with 32 additions and 30 deletions
|
@ -60,8 +60,15 @@ class acp_main
|
||||||
{
|
{
|
||||||
if ($action === 'admlogout')
|
if ($action === 'admlogout')
|
||||||
{
|
{
|
||||||
$user->unset_admin();
|
if (check_link_hash($request->variable('hash', ''), 'acp_logout'))
|
||||||
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
|
{
|
||||||
|
$user->unset_admin();
|
||||||
|
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
redirect(append_sid("{$phpbb_admin_path}index.$phpEx"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!confirm_box(true))
|
if (!confirm_box(true))
|
||||||
|
|
|
@ -3716,7 +3716,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
|
||||||
// Generate logged in/logged out status
|
// Generate logged in/logged out status
|
||||||
if ($user->data['user_id'] != ANONYMOUS)
|
if ($user->data['user_id'] != ANONYMOUS)
|
||||||
{
|
{
|
||||||
$u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout');
|
$u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout&hash=' . generate_link_hash('ucp_logout'));
|
||||||
$l_login_logout = $user->lang['LOGOUT'];
|
$l_login_logout = $user->lang['LOGOUT'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -85,7 +85,7 @@ function adm_page_header($page_title)
|
||||||
'PHPBB_MAJOR' => $phpbb_major,
|
'PHPBB_MAJOR' => $phpbb_major,
|
||||||
|
|
||||||
'U_LOGOUT' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout'),
|
'U_LOGOUT' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout'),
|
||||||
'U_ADM_LOGOUT' => append_sid("{$phpbb_admin_path}index.$phpEx", 'action=admlogout'),
|
'U_ADM_LOGOUT' => append_sid("{$phpbb_admin_path}index.$phpEx", 'action=admlogout&hash=' . generate_link_hash('acp_logout')),
|
||||||
'U_ADM_INDEX' => append_sid("{$phpbb_admin_path}index.$phpEx"),
|
'U_ADM_INDEX' => append_sid("{$phpbb_admin_path}index.$phpEx"),
|
||||||
'U_INDEX' => append_sid("{$phpbb_root_path}index.$phpEx"),
|
'U_INDEX' => append_sid("{$phpbb_root_path}index.$phpEx"),
|
||||||
|
|
||||||
|
|
|
@ -275,7 +275,7 @@ class session
|
||||||
$SID = '?sid=';
|
$SID = '?sid=';
|
||||||
$_SID = '';
|
$_SID = '';
|
||||||
|
|
||||||
if (empty($this->session_id))
|
if (empty($this->session_id) && $phpbb_container->getParameter('session.force_sid'))
|
||||||
{
|
{
|
||||||
$this->session_id = $_SID = $request->variable('sid', '');
|
$this->session_id = $_SID = $request->variable('sid', '');
|
||||||
$SID = '?sid=' . $this->session_id;
|
$SID = '?sid=' . $this->session_id;
|
||||||
|
@ -284,7 +284,7 @@ class session
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->session_id = $_SID = $request->variable('sid', '');
|
$this->session_id = $_SID = $phpbb_container->getParameter('session.force_sid') ? $request->variable('sid', '') : '';
|
||||||
$SID = '?sid=' . $this->session_id;
|
$SID = '?sid=' . $this->session_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<a href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a>
|
<a href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- IF S_AUTOLOGIN_ENABLED -->
|
<!-- IF S_AUTOLOGIN_ENABLED -->
|
||||||
<span class="responsive-hide">|</span> <label for="autologin">{L_LOG_ME_IN} <input type="checkbox" tabindex="4" name="autologin" id="autologin" /></label>
|
<span class="responsive-hide">|</span> <label for="autologin">{L_LOG_ME_IN} <input type="checkbox" tabindex="4" name="autologin" id="autologin" checked /></label>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<input type="submit" tabindex="5" name="login" value="{L_LOGIN}" class="button1 button button-form-bold" />
|
<input type="submit" tabindex="5" name="login" value="{L_LOGIN}" class="button1 button button-form-bold" />
|
||||||
{S_LOGIN_REDIRECT}
|
{S_LOGIN_REDIRECT}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<!-- IF S_DISPLAY_FULL_LOGIN -->
|
<!-- IF S_DISPLAY_FULL_LOGIN -->
|
||||||
<dl>
|
<dl>
|
||||||
<dt> </dt>
|
<dt> </dt>
|
||||||
<!-- IF S_AUTOLOGIN_ENABLED --><dd><label for="autologin"><input type="checkbox" name="autologin" id="autologin" tabindex="4" /> {L_LOG_ME_IN}</label></dd><!-- ENDIF -->
|
<!-- IF S_AUTOLOGIN_ENABLED --><dd><label for="autologin"><input type="checkbox" name="autologin" id="autologin" tabindex="4" checked /> {L_LOG_ME_IN}</label></dd><!-- ENDIF -->
|
||||||
<dd><label for="viewonline"><input type="checkbox" name="viewonline" id="viewonline" tabindex="5" /> {L_HIDE_ME}</label></dd>
|
<dd><label for="viewonline"><input type="checkbox" name="viewonline" id="viewonline" tabindex="5" /> {L_HIDE_ME}</label></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="password">{L_PASSWORD}{L_COLON}</label></dt>
|
<dt><label for="password">{L_PASSWORD}{L_COLON}</label></dt>
|
||||||
<dd><input type="password" tabindex="2" id="password" name="password" size="25" class="inputbox autowidth" autocomplete="off" /></dd>
|
<dd><input type="password" tabindex="2" id="password" name="password" size="25" class="inputbox autowidth" autocomplete="off" /></dd>
|
||||||
<!-- IF S_AUTOLOGIN_ENABLED --><dd><label for="autologin"><input type="checkbox" name="autologin" id="autologin" tabindex="3" /> {L_LOG_ME_IN}</label></dd><!-- ENDIF -->
|
<!-- IF S_AUTOLOGIN_ENABLED --><dd><label for="autologin"><input type="checkbox" name="autologin" id="autologin" tabindex="3" checked /> {L_LOG_ME_IN}</label></dd><!-- ENDIF -->
|
||||||
<dd><label for="viewonline"><input type="checkbox" name="viewonline" id="viewonline" tabindex="4" /> {L_HIDE_ME}</label></dd>
|
<dd><label for="viewonline"><input type="checkbox" name="viewonline" id="viewonline" tabindex="4" /> {L_HIDE_ME}</label></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
|
|
|
@ -103,7 +103,7 @@ switch ($mode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'logout':
|
case 'logout':
|
||||||
if ($user->data['user_id'] != ANONYMOUS && $request->is_set('sid') && $request->variable('sid', '') === $user->session_id)
|
if ($user->data['user_id'] != ANONYMOUS && check_link_hash($request->variable('hash', ''), 'ucp_logout'))
|
||||||
{
|
{
|
||||||
$user->session_kill();
|
$user->session_kill();
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,12 +60,7 @@ class phpbb_functional_auth_test extends phpbb_functional_test_case
|
||||||
$this->login();
|
$this->login();
|
||||||
$this->add_lang('ucp');
|
$this->add_lang('ucp');
|
||||||
|
|
||||||
// logout
|
$this->logout();
|
||||||
$crawler = self::request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout');
|
|
||||||
|
|
||||||
// look for a register link, which should be visible only when logged out
|
|
||||||
$crawler = self::request('GET', 'index.php');
|
|
||||||
$this->assertStringContainsString($this->lang('REGISTER'), $crawler->filter('.navbar')->text());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_acp_login()
|
public function test_acp_login()
|
||||||
|
|
|
@ -46,6 +46,7 @@ class phpbb_functional_mcp_test extends phpbb_functional_test_case
|
||||||
public function test_move_post_to_topic($crawler)
|
public function test_move_post_to_topic($crawler)
|
||||||
{
|
{
|
||||||
$this->login();
|
$this->login();
|
||||||
|
$this->add_lang('mcp');
|
||||||
|
|
||||||
// Select the post in MCP
|
// Select the post in MCP
|
||||||
$form = $crawler->selectButton($this->lang('SUBMIT'))->form(array(
|
$form = $crawler->selectButton($this->lang('SUBMIT'))->form(array(
|
||||||
|
@ -55,18 +56,11 @@ class phpbb_functional_mcp_test extends phpbb_functional_test_case
|
||||||
$crawler = self::submit($form);
|
$crawler = self::submit($form);
|
||||||
$this->assertStringContainsString($this->lang('MERGE_POSTS'), $crawler->filter('html')->text());
|
$this->assertStringContainsString($this->lang('MERGE_POSTS'), $crawler->filter('html')->text());
|
||||||
|
|
||||||
return $crawler;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @depends test_move_post_to_topic
|
|
||||||
*/
|
|
||||||
public function test_confirm_result($crawler)
|
|
||||||
{
|
|
||||||
$this->add_lang('mcp');
|
|
||||||
$form = $crawler->selectButton('Yes')->form();
|
$form = $crawler->selectButton('Yes')->form();
|
||||||
$crawler = self::submit($form);
|
$crawler = self::submit($form);
|
||||||
$this->assertStringContainsString($this->lang('POSTS_MERGED_SUCCESS'), $crawler->text());
|
$this->assertStringContainsString($this->lang('POSTS_MERGED_SUCCESS'), $crawler->text());
|
||||||
|
|
||||||
|
return $crawler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_delete_logs()
|
public function test_delete_logs()
|
||||||
|
|
|
@ -64,8 +64,8 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca
|
||||||
$values = $form->getValues();
|
$values = $form->getValues();
|
||||||
$values["setting[1][2][f_report]"] = $report_post_allowed;
|
$values["setting[1][2][f_report]"] = $report_post_allowed;
|
||||||
$form->setValues($values);
|
$form->setValues($values);
|
||||||
$crawler = self::submit($form);
|
self::submit($form);
|
||||||
|
|
||||||
$crawler = self::request('GET', 'ucp.php?mode=logout&sid=' . $this->sid);
|
$this->logout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,10 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case
|
||||||
$this->assertStringContainsString($key_id, $crawler->filter('label[for="' . $key_id . '"]')->text());
|
$this->assertStringContainsString($key_id, $crawler->filter('label[for="' . $key_id . '"]')->text());
|
||||||
|
|
||||||
$form = $crawler->selectButton('submit')->form();
|
$form = $crawler->selectButton('submit')->form();
|
||||||
$form['keys'][0]->tick();
|
foreach ($form['keys'] as $key)
|
||||||
|
{
|
||||||
|
$key->tick();
|
||||||
|
}
|
||||||
$crawler = self::submit($form);
|
$crawler = self::submit($form);
|
||||||
$this->assertStringContainsString($this->lang('AUTOLOGIN_SESSION_KEYS_DELETED'), $crawler->filter('html')->text());
|
$this->assertStringContainsString($this->lang('AUTOLOGIN_SESSION_KEYS_DELETED'), $crawler->filter('html')->text());
|
||||||
|
|
||||||
|
|
|
@ -829,10 +829,13 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
{
|
{
|
||||||
$this->add_lang('ucp');
|
$this->add_lang('ucp');
|
||||||
|
|
||||||
$crawler = self::request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout');
|
$crawler = self::request('GET', 'index.php');
|
||||||
|
$logout_link = $crawler->filter('a[title="' . $this->lang('LOGOUT') . '"]')->attr('href');
|
||||||
|
self::request('GET', $logout_link);
|
||||||
|
|
||||||
|
$crawler = self::request('GET', $logout_link);
|
||||||
$this->assertStringContainsString($this->lang('REGISTER'), $crawler->filter('.navbar')->text());
|
$this->assertStringContainsString($this->lang('REGISTER'), $crawler->filter('.navbar')->text());
|
||||||
unset($this->sid);
|
unset($this->sid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue