Advertisement:

Author Topic: Quick login does not remember last page properly  (Read 11128 times)

Offline _Jojo_

  • Jr. Member
  • **
  • Posts: 258
Quick login does not remember last page properly
« on: October 28, 2010, 06:39:55 PM »
1) Try to view a member's profile as a guest on a SMF 2.0 forum (hiding profiles to guests must be enabled). You will be prompted to log in.
2) Don't log in, instead, try to read a topic on the board (which should be possible to guests).
3) From this topic, use the quick login in the header.
Now you should see the member's profile from step 1 instead of the viewed topic.
« Last Edit: October 29, 2010, 05:36:17 PM by _Jojo_ »
Achtung: Dieser Post befindet sich noch im Beta-Stadium und kann durchaus Fehler in der Groß- und Kleinschreibung oder sonstige Unklarheiten enthalten. Wenden Sie sich bei Problemen an den Support.

Offline _Jojo_

  • Jr. Member
  • **
  • Posts: 258
Re: Quick login does not remember last page properly
« Reply #1 on: November 14, 2011, 12:35:52 PM »
As this thread got moved, I'd like to just have a short feedback whether this issue got resolved, is a duplicate or is considered a feature? I couldn't find an entry for this on the issue tracker so I'm not sure. The problem still persists with SMF 2.0.1 for me.
Achtung: Dieser Post befindet sich noch im Beta-Stadium und kann durchaus Fehler in der Groß- und Kleinschreibung oder sonstige Unklarheiten enthalten. Wenden Sie sich bei Problemen an den Support.

Offline Illori

  • Project Manager
  • SMF Master
  • *
  • Posts: 48,067
Re: Quick login does not remember last page properly
« Reply #2 on: November 14, 2011, 12:37:40 PM »
i tested this issue as you explained and i got redirected back to the same page i logged it at with the quick login. so i dont consider it a bug.

Offline _Jojo_

  • Jr. Member
  • **
  • Posts: 258
Re: Quick login does not remember last page properly
« Reply #3 on: November 14, 2011, 12:45:45 PM »
The problem is easily reproducible with a freshly installed SMF 2.0.1, using both Firefox and Opera:
- Forbid guests to view member profiles.
- Log out, try to visit a member profile. This should give you a login prompt.
- Instead of logging in, go to the board index and visit a random topic.
- While in this topic, use the quick login feature to log in. You should now see the member's profile instead of the previously viewed topic.

As said, it's perfectly reproducible on a fresh SMF 2.0.1 install here, no matter what browser, no matter what server operating system (PHP5 on Windows / Debian).
Achtung: Dieser Post befindet sich noch im Beta-Stadium und kann durchaus Fehler in der Groß- und Kleinschreibung oder sonstige Unklarheiten enthalten. Wenden Sie sich bei Problemen an den Support.

Offline Illori

  • Project Manager
  • SMF Master
  • *
  • Posts: 48,067
Re: Quick login does not remember last page properly
« Reply #4 on: November 14, 2011, 12:48:38 PM »
i can duplicate it now that you explained it again. i am still not sure how often if at all this would really come up, and with no comments on this report for a year makes me think no one thinks it is much of an issue worth looking into. the quick login works fine for me when you are the index a board or a topic.

Offline _Jojo_

  • Jr. Member
  • **
  • Posts: 258
Re: Quick login does not remember last page properly
« Reply #5 on: November 14, 2011, 12:52:19 PM »
Well, to me this happens quite frequently and it's also kind of annoying when it happens. I haven't looked into the code but it would seem to be that some kind of flag is set when visiting member profiles and is not unset when visiting another page instead.

Either way, I'd say this is not a bogus bug, nor is it fixed, so it should be moved back again.
« Last Edit: November 14, 2011, 01:01:15 PM by _Jojo_ »
Achtung: Dieser Post befindet sich noch im Beta-Stadium und kann durchaus Fehler in der Groß- und Kleinschreibung oder sonstige Unklarheiten enthalten. Wenden Sie sich bei Problemen an den Support.

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Quick login does not remember last page properly
« Reply #6 on: February 05, 2012, 10:15:11 PM »
It has to something with "$_SESSION['login_url']" and "$_SESSION['old_url']".

I'll debug this once I get back to my PC.
Github Profile
My Mods
How to enable Post Moderation
Paid Support
Elkarte


"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Offline Joshua Dickerson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,775
  • Gender: Male
    • joshuaadickerson on GitHub
    • joshuaadickerson on LinkedIn
Re: Quick login does not remember last page properly
« Reply #7 on: March 01, 2012, 10:09:47 PM »
Joker, any luck?
Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Quick login does not remember last page properly
« Reply #8 on: March 03, 2012, 09:08:10 PM »
Joshua, got a few mins for debugging :P.

Here is some data populated by the script:

1. Click on Profile as guest:
Login URL -- Nothing
Old URL: http://localhost/smf2/index.php


2. Come back to main page (Seems fine upto here)
Login URL -- http://localhost/smf2/index.php?action=profile;u=1
Old URL: http://localhost/smf2/index.php?action=profile;u=1


3. Go to some topic (See below, url weirdness starts here)
Login URL -- http://localhost/smf2/index.php?action=profile;u=1
Old URL: http://localhost/smf2/index.php


Now if someone is going to make a login is he going to be redirected according to 'login_url' as per this code in LogInOut.php

Code: [Select]
// Some whitelisting for login_url...
if (empty($_SESSION['login_url']))
redirectexit();
else
{
// Best not to clutter the session data too much...
$temp = $_SESSION['login_url'];
unset($_SESSION['login_url']);

redirectexit($temp);
}


My suggestion would be to re-factorize the 'login_url' variable and place the current link in it, as even the 'old_url' variable is running one step behind the actual query string.
Github Profile
My Mods
How to enable Post Moderation
Paid Support
Elkarte


"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Quick login does not remember last page properly
« Reply #9 on: March 09, 2012, 06:56:28 PM »
The problem here is that when you arrive at the login page (through profile) $_SESSION['login_url'] is set, then the quick login doesn't pass through the function Login and 'old_url' doesn't overwrite 'login_url', so you are redirected to Login2 with 'login_url' set (when accessing the login page viewing the profile) to the wrong address.

The only reliable way to overcome this problem I can think it let Login2 know that we are coming from the quicklogin (i.e. add a ";quicklogin" to the form action url). Then we have to re-set the 'login_url' in Login2:
Code: (find) [Select]
if (empty($_SESSION['login_url']) && isset($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'dlattach') === false && preg_match('~(board|topic)[=,]~', $_SESSION['old_url']) != 0)
Code: (replace with) [Select]
if ((empty($_SESSION['login_url']) && isset($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'dlattach') === false && preg_match('~(board|topic)[=,]~', $_SESSION['old_url']) != 0) || (isset($_GET['quicklogin']) && isset($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'login') === false))
The strpos($_SESSION['old_url'], 'login') === false will prevent the user from being redirected to the login page in the case of the (non particularly clever) action of logging in from the quick-login at the login page.
« Last Edit: March 09, 2012, 07:07:26 PM by emanuele »


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline danwsc

  • Semi-Newbie
  • *
  • Posts: 22
Re: Quick login does not remember last page properly
« Reply #10 on: March 10, 2012, 09:03:06 PM »

Hi emanuele,

I have I think a variation of the issue.  I intentionally want to stay on some modified pages that I come up with, how do I do it please?
Whilst I want to retain SMF normal operation on non-modified pages.
My thread is at
http://www.simplemachines.org/community/index.php?topic=470808.0

Thanks and Regards.

Offline _Jojo_

  • Jr. Member
  • **
  • Posts: 258
Re: Quick login does not remember last page properly
« Reply #11 on: June 05, 2012, 10:39:27 AM »
I guess this thread still shouldn't be in the "fixed or bogus bugs" board? At least the problem still appears with SMF 2.0.2.
Achtung: Dieser Post befindet sich noch im Beta-Stadium und kann durchaus Fehler in der Groß- und Kleinschreibung oder sonstige Unklarheiten enthalten. Wenden Sie sich bei Problemen an den Support.

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Quick login does not remember last page properly
« Reply #12 on: June 05, 2012, 10:48:42 AM »
Not being a security issue most likely it will never be fixed in the 2.0.x series.
It is in this board because it's fixed in the development version of 2.1. :)


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline _Jojo_

  • Jr. Member
  • **
  • Posts: 258
Re: Quick login does not remember last page properly
« Reply #13 on: June 05, 2012, 10:50:44 AM »
Ok, good to know.
Achtung: Dieser Post befindet sich noch im Beta-Stadium und kann durchaus Fehler in der Groß- und Kleinschreibung oder sonstige Unklarheiten enthalten. Wenden Sie sich bei Problemen an den Support.