Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Mojolicious session does not expire

by Anonymous Monk
on Aug 29, 2017 at 12:39 UTC ( [id://1198265]=note: print w/replies, xml ) Need Help??


in reply to Re: Mojolicious session does not expire
in thread Mojolicious session does not expire

I know it's been a while, but we're still experiencing the same problem. The session is somehow not cleared. This code gets executed during logout:  "$self->session(expires => 1);

Then, at login, printing the session variable  say $self->session('username'); sometimes yields the username and the user remains logged in, sometimes it is undefined and the user can log out successfully. I was not able to find a pattern for this, but it doesn't fail only on the server, it also fails on localhost, so there's no connection to that.

Replies are listed 'Best First'.
Re^3: Mojolicious session does not expire
by Corion (Patriarch) on Aug 29, 2017 at 12:43 UTC

    Have you investigated whether your script sends the correct Set-Cookie headers upon logout?

    If yes, there is a problem with the browser, in that it maybe has old cookies that the program still considers valid.

    If no, investigate why the cookie headers are not sent.

Re^3: Mojolicious session does not expire
by Anonymous Monk on Aug 29, 2017 at 18:28 UTC
    I found the error, the request was made using an <a href="" onclick="do_logout()"></a>, which was basically doing 2 actions at once and creating a race condition. Here is the relevant code snippet https://ideone.com/UUeYRw
    Thanks for helping!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1198265]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-20 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found