My scenario for banking security :Once I log in by entering the username and password in one browser tab,then if I duplicate the browser or open the application again in a new tab,the login screen should appear again login screen and ask credential again.Please modify my oml.Thankyou
Hi Joey,For banking-style security where each tab requires its own login, you can use 'sessionStorage', which is unique per browser tab. Please follow these simple steps to achieve it:1. On successful login, add the below js to ensure the authentication
sessionStorage.setItem("IsAuthenticated", "true");2.Add a Onready to the layout of the screen :
var isAuth = sessionStorage.getItem("IsAuthenticated");
$public.ReturnValue = isAuth === "true";3. Clear the session while you logout:
sessionStorage.clear();
I hope Its helpful.
Hello @Joey Olive
Let me share a step process you can follow
First:-
Second:-
Third:-
Set TabUnique to NULL in DB on logout.
Note:- for setting sessionStorage use setItem, and for getting sessionStorage use getItem with your key name
Thanks
Regards,
Gourav Shrivastava
@Joey Olive : I understand that you want the user to log in again from the new tab. What about the previous tab? Do you expect the same user to be logged in from two different tabs?
Hello @Siya :1. I want when I login on the first tab, it should open. But it should not open on the second tab, the login screen should appear again. 2. The first tab should already remain open even after refreshing.
Hi @Joey Olive,
It’s a valid solution as the fellow members suggested. But you have to keep in mind one more constraint:
if you duplicate the tab, even sessionStorage will be cloned, so it won’t help you to force logout in that case.
To handle this, after creating the tabToken as mentioned above, you should also store it in a window property like this below
window._tabToken = "<token value>";
When a tab is duplicated, window._tabToken will be null or undefined, since memory-only variables don’t carry over.
You can use this to verify that the current tab is the original and not a duplicate by comparing window._tabToken with the value stored in sessionStorage.Also, if you’re using OutSystems Login (which relies on cookies), logging out in one tab will log out all tabs — because cookies are shared across tabs.
Hope this helps!