PDA

View Full Version : Concept: How would login work?



PCSpectra
16 Nov 2009, 3:53 PM
I see a plugin about implementing login but I'm still confused how server side authentication would integrate into a client library like extJS.

For instance I have several PHP controller:actions one of which (as I understand) will generate the GUI which itself might be composed of various panels which pull on server data via AJAX.

What happens if after 25 mins I click on an item in a tree control and the session expired (on the server) and content cannot be retreived?

My actions by default echo an array of messages, so I assume all I have to do is convert the array into a JSON object and explicitly check for messages in each extJS request?

Cheers,
Alex

Mike Robinson
17 Nov 2009, 9:39 AM
This is being discussed even-now on another thread over here (http://www.extjs.com/forum/showthread.php?t=85555).

If the server-side decides to dump a session, future AJAX (or other) requests will be refused because they no longer carry an active session-identifier. The responses will have "success: false," along with some kind of explanation. This can be detected at the class-level (as discussed in the other thread (http://www.extjs.com/forum/showthread.php?t=85555)).

This will cause the various requests to trip their "failure" handler instead of their "success" handler.

So, whereas a "success" response might (in your design...) include "an array of messages" as part of its response, in this case the response wasn't successful at all, and the content of the failure-packet which the PHP side returns might (or, according to your chosen design, might not) be different.

In the AJAX world, JavaScript code is responsible for the entire user-interface behavior.

PCSpectra
17 Nov 2009, 1:50 PM
Thanks for the reply, I'll read up on the other thread too, thank you. :)

Cheers,
Alex