Fork me on GitHub
Subscribe 2

Ticket #743 (fixed bug)

Login from viewtopic.php?pid=XXX#pXXX

  • Created: 2012-09-25 22:12:52
  • Reported by: nightware
  • Assigned to: quy
  • Milestone: 1.5.1
  • Component: code
  • Priority: normal

Login from viewtopic.php?pid=XXX#pXXX does not redirect you back to the post XXX. This is especially the case, when clicking on links sent by email and then having to login.
As a fix, i propose the following change, as I have done:
if (!isset($redirect_url))
    $redirect_url = 'index.php';
// <add mod_login_redirect_url=v0.1>
if (preg_match('/viewtopic\.php\?pid=(\d+)$/', $redirect_url, $match))
    $redirect_url .= '#p' . $match[1];
// </add>
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Login']);
$required_fields = array('req_username' => $lang_common['Username'], 'req_password' => $lang_common['Password']);
$focus_element = array('login', 'req_username');
define('PUN_ACTIVE_PAGE', 'login');
require PUN_ROOT.'header.php';

I don't know the exact line, but it should be around 270 in /login.php. This redirects to the according post by detecting the pid-string in the url.

This 'misbehaviour' is orginiated in the fact, that the Referrer does not transfer anchor information ('#pXXX'). Since viewtopic.php?pid= is only used with the anchor, ie. it does not occur without the anchor in the code.

also note, this is not the same, but similar to #681

History

nightware 2012-09-25 22:13:53

  • Description changed. (Diff)

nightware 2012-09-25 22:15:10

  • Description changed. (Diff)

quy 2012-10-09 01:57:49

Commit a48201e to fluxbb master

#743: Append pid to redirect_url in login.php since referer does not have anchor information

quy 2012-10-09 01:59:30

  • Milestone set to 1.5.1.
  • Owner set to quy.
  • Status changed from open to fixed.

Thanks.

quy 2012-10-10 19:44:02

Commit 0011b80 to fluxbb master

#743: Append pid to redirect_url when using email link in a post.