Single session login user
Application Type
Mobile, Reactive

I wanted to build a common web and mobile application to check whether the user is logged in any of the devices or not. If any of the user is logged in while I'll logging in with same username the logged in user must get automatically logged out. The username should only be logged in once at a time. How can I achieve this? I'm just a beginner. So, detailed explanation with .oml file would be helpful. Thanks in advance :)

Hi @Ajay Kiran P 

Basically, you need to create an entity that allows to you manage the users that are logged.

Check the oml attached

Regards.

Gonçalo Almeida

SingleLogin.oml

Hi Ajay,

sorry but I have no time for an OML, I'll just explain.

When the user logs in, you must generate a UID for that session. It should be stored in a Session variable and in the database. You can create a table UserSession (Id, UserId, SessionUID) to register the last login UID assigned.

Then on every screen you must add a block that check if the Session variable UID is the same as the SessionUID in the database. If it's not than it should logout.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.