PDA

View Full Version : Login extensions???



PCSpectra
4 Mar 2010, 11:52 AM
I have read a few articles/forum threads over the Internet and I get the gist of what is required but I wonder, still...

Ideally there would be a way to hook into every request made in an extJS application, check it's responseText and convert to JSON object and check for auth field being set or something.

That way I could simple drop this extension into the application and not have to worry about wiring it into every single AJAX request, etc.

Not to mention, how do you handle grids, etc? They do no seem to have a success/failure handler, do they?

I have the form built and ready to rock, I just need a way to invoke that dialog everytime a SESSION expires in the backend and a request triggers this 'auth' field to be set to true.

Any ideas, resources, etc???

EDIT | I have already looked at the following:

http://www.extjs.com/learn/Tutorial:Writing_Ext_2_Plugins
http://www.extjs.com/learn/Manual:Component:Extension_or_Plugin

EDIT 2 | I am also thinking perhaps setting up a global polling check that queries the server for a valid session ID every few seconds and redirects on failure. I would prefer to write a hook and register the hook once at startup not sure whether extJS supports such a hooking mechanism though. Up til now I have centralized failure checking in a single callback which I then register with every AJAX request or FORM submission. Needless to say it's error prone and requires to me remember to register that callback as the success or failure handler for everything.

Cheers,
Alex