petru.tr has asked for the wisdom of the Perl Monks concerning the following question:
I'm building a web application using mojolicious. The logout functionality works only while running the app on local machines. When I try to logout on the app running on the server, the session does not expire and I remain logged in.
This started to happen when we changed logout to be done via POST request instead of get.
The way we call logout is as an AJAX call from the frontend:
Logout route:function do_logout() { $.post( "<%= url_for('on_logout') %>", function() {}); }
Logout controller:$if_login->post('/logout')->name('on_logout')->to('user#on_logout');
sub on_logout { my $self = shift; $self->session(expires => 1); return $self->redirect_to('home'); }
Line which sets the session to expire is called, but after the redirect, session still contains the username which was logged in.
I've posted the question on stackoverflow if you want to get some rep
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Mojolicious session does not expire
by Mr. Muskrat (Canon) on Aug 09, 2017 at 16:21 UTC | |
by Anonymous Monk on Aug 09, 2017 at 16:23 UTC | |
by Anonymous Monk on Aug 29, 2017 at 12:39 UTC | |
by Corion (Patriarch) on Aug 29, 2017 at 12:43 UTC | |
by Anonymous Monk on Aug 29, 2017 at 18:28 UTC | |
Re: Mojolicious session does not expire
by Anonymous Monk on Aug 09, 2017 at 16:18 UTC |
Back to
Seekers of Perl Wisdom