Prompting for Login

November 1, 2013

[Logo] OpenWeb Solutions, LLC


In a user-authenticated application, provide the user with the ability to re-login if the session has timed out prior to submitting a POST request.


Normal login form

[Normal login form]

Filling out form; session times out

[POST form]

Submit results in AJAX check

[AJAX login]


The AJAX login form provides a mechanism that impedes the normal request to the server until the user has re-logged in, as verified by the status code of submitting the login form.

This way, the user does not lose the POST data when taking a long time to fill out the form.

Finally, this solution degrades nicely: if Javascript is not available, the user will still be able to fill out the form, they just run the risk of data loss on some edge cases.