Ajax requests not redirecting to Login page after session timeout

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Ajax requests not redirecting to Login page after session timeout

Mariano Martinez Peck
Hi guys,

If I have a session timeout, and then I click on a anchor that is associated to a ajax call, it does nothing (which is expected) but it does not forward me to the Login page either, as it happens with a timeout and a normal request.

Any idea how can solve this?

I saw in another email this:

        html document
                addLoadScript:
                        (html jQuery document
                                onAjaxError: (self ajaxErrorHandler asFunction: #('event' 'jqxhr'
'settings' 'exception')))

But not sure if it is of help.

Thanks in advance, 



--

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Ajax requests not redirecting to Login page after session timeout

Paul DeBruicker
Hi Mariano,

Thats something I wrote.  The #ajaxErrorHandler method goes like this:


ajaxErrorHandler
        ^ ' if (jqxhr.status == 403) {
            alert("For security reasons we sign people out during periods of inactivity. Please sign in again.");
            window.location.href = settings.url.split("?")[0].replace("help","");
        } else {
            alert("This program just broke. You can either try again, sign out and sign in and try again, or contact us about error: " + exception);  
        }'


the window.location.href line just cleans up the page url by removing the expired session info.  Seaside then starts a new session and the url is sent through the #initialRequest: mechanism.  In #initialRequest: for my application I detect which page they were on, show them the login page, then once they've authenticated show them the page they were on.  



Hope this helps


Paul.





Mariano Martinez Peck wrote
Hi guys,

If I have a session timeout, and then I click on a anchor that is
associated to a ajax call, it does nothing (which is expected) but it does
not forward me to the Login page either, as it happens with a timeout and a
normal request.

Any idea how can solve this?

I saw in another email this:

        html document
                addLoadScript:
                        (html jQuery document
                                onAjaxError: (self ajaxErrorHandler
asFunction: #('event' 'jqxhr'
'settings' 'exception')))

But not sure if it is of help.

Thanks in advance,



--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Ajax requests not redirecting to Login page after session timeout

Mariano Martinez Peck


On Thu, Jan 29, 2015 at 3:27 PM, Paul DeBruicker <[hidden email]> wrote:
Hi Mariano,

Thats something I wrote.  The #ajaxErrorHandler method goes like this:


ajaxErrorHandler
        ^ ' if (jqxhr.status == 403) {
            alert("For security reasons we sign people out during periods of
inactivity. Please sign in again.");
            window.location.href =
settings.url.split("?")[0].replace("help","");
        } else {
            alert("This program just broke. You can either try again, sign
out and sign in and try again, or contact us about error: " + exception);
        }'


the window.location.href line just cleans up the page url by removing the
expired session info.  Seaside then starts a new session and the url is sent
through the #initialRequest: mechanism.  In #initialRequest: for my
application I detect which page they were on, show them the login page, then
once they've authenticated show them the page they were on.


Thanks Paul!!! That did work perfectly. 

Thank you very much. 

 


Hope this helps


Paul.






Mariano Martinez Peck wrote
> Hi guys,
>
> If I have a session timeout, and then I click on a anchor that is
> associated to a ajax call, it does nothing (which is expected) but it does
> not forward me to the Login page either, as it happens with a timeout and
> a
> normal request.
>
> Any idea how can solve this?
>
> I saw in another email this:
>
>         html document
>                 addLoadScript:
>                         (html jQuery document
>                                 onAjaxError: (self ajaxErrorHandler
> asFunction: #('event' 'jqxhr'
> 'settings' 'exception')))
>
> But not sure if it is of help.
>
> Thanks in advance,
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
> _______________________________________________
> seaside mailing list

> seaside@.squeakfoundation

> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside





--
View this message in context: http://forum.world.st/Ajax-requests-not-redirecting-to-Login-page-after-session-timeout-tp4802509p4802521.html
Sent from the Seaside General mailing list archive at Nabble.com.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



--

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside