Last_login updating without going through login action

Hello,


I have another question about User.Last_Login.


Similarly to https://www.outsystems.com/forums/discussion/10075/last-login-in-users-entity/ 

I have found that the User.Last_Login field is updated without the user going through Login.

I have tried to implement a system which will track last logins for each of our applications, by putting an action after the Login action to collect that data.

However in our admin area to display this, i see the User.Last_Login is updated but not the login data im trying to collect.

All of the applications use the same user provider, so there is single sign on happening. Wonder if there was a way to track this update, as I dont want to put this Action in the preparation/on after fetch of every Home screen on each application, for fear of performance loses.


Any help would be appreciated. 

Chris

Hi Chris,

Do you happen to have Persistent Login enabled?
This will cause the user to login, without passing your normal login logic with the username and password check.

You don't have to put this check in each screen. You can put it in the OnSessionStart of the User Provider. This will be triggered when a user is logged in, also when using persistent login.

Regards,
Lennart

Lennart Kraak wrote:

Hi Chris,

Do you happen to have Persistent Login enabled?
This will cause the user to login, without passing your normal login logic with the username and password check.

You don't have to put this check in each screen. You can put it in the OnSessionStart of the User Provider. This will be triggered when a user is logged in, also when using persistent login.

Regards,
Lennart

I believe we are. We allow the users to set the "Remember Me" on login to any of the applications. 


Forgive my ignorance, but we use the default OutSystems Users provider, how can I add an action to OnSessionStart Action?

 

You cannot add actions there. You can always start with using OnSessionStart of the module in which the users enter. 

Lennart Kraak wrote:

You cannot add actions there. You can always start with using OnSessionStart of the module in which the users enter. 

 

 Hello Lennart, 


Thank you for that. How do I find the OnSessionStart of the Module? I dont see it as an action which is used or a place to add an action to on a screen etc.  

Solution

Right-click on Server Actions > Add System Event > On Session Start

The action will be triggered:

- in the first request to the server

- after login

- after logout

Solution

Lennart Kraak wrote:

Right-click on Server Actions > Add System Event > On Session Start

The action will be triggered:

- in the first request to the server

- after login

- after logout

Thank you so much Lennart! Every day's a school day! Honestly didnt know that existed! 

Marked as solution. 

 

Kind regards,

Chris