Hello everyone.
I would like to know how to control a user's ability to have only one active session, meaning the same user cannot log in with their username two or more times simultaneously.
Hello everyone.
I would like to know how to control a user's ability to have only one active session, meaning the same user cannot log in with their username two or more times simultaneously.
I managed to do it through testing, but I don't know if it's the best way.
1st, I created a field in the user table called token_user_ativo
2nd, Login action - After logging in.
SetSession Name: token = UUID
Update the table using this SetSession
3rd, In the logged-in user action that I have in the page layout, I added the token variable to $_Session
I check if the logged-in user's token is equal to this session variable token and if not, I redirect to the login page.