How do you register a user in the popup?
I have an application that requires the user to re-enter their password between 15 and 30 minutes of inactivity to allow them to continue what they are doing.
My current idea is to add a piece of javascript that brings up a popup after 15 minutes and ask the user to login again. The site as a whole has an authentication timeout of 15 minutes and a 30 minute session timeout.
Then I would like the original page to have a postback if the user is successfully authenticated in the popup.
I currently have a popup (with a 15 minute countdown using JS) and the user can login again, however, when the popup is closed and the user tries to perform an action on their original page, they asked to login again ...
I'm guessing this is because the original cookie attached to the original page has expired and it won't detect a new one.
How do I pass a successful authentication from the popup to the original page?
a source to share
If you add a meta tag or hidden div that populates the authentication token in the content attribute for the meta tag, but only in the body of the div for the hidden div, you can retrieve it from the popup ...
var debugWin = window.open('','aWindow','width=600,height=600,scrollbars=yes');
var somevar = debugWin.document.body.getElementById("my_hidden_div_id").innerText;
Then you can update the session cookie with somevar content from JavaScript. As long as you keep the pen in the window, you should be able to get into the DOM window.
There might be some difference between browsers in how you get into the dom, I think IE has a slightly different method, but it's easy to test and the result is the same.
a source to share
I would create a panel that requires a password and using a button with the correct code.
You can then use AJAX or jQuery to trigger the "popup" modal to require them to provide details. By doing this, you can keep everything on one page without having to worry about passing credentials between pages / forms / tabs / whatever.
Also, you can have 1 script method that runs after x minutes to request an update, and have a second javascript that runs after x + 2 minutes to get the user out of the app if they can't respond.
In your code method you can reset all cookies and reset timeouts and can be reused on any page.
a source to share