Expand my Community achievements bar.

Last successful login date

Avatar

Level 4

Hi Folks, 

 

I have two requirements in which

 

1.I have to display last successful login time on the home page when a user logged in to the AEM based website. 

 

2.I have to display last successful login time on the logged in page when a user logged in to the AEM application (aem jar) itself. 

 

How can I achieve ? Please explain steps. 

 

Thankyou in advance

4 Replies

Avatar

Community Advisor

@shikhasoni1 every time the user logs-in , you can add a custom property in the user's profile node. This property can store current login timestamp. Lets call it last-logon-date . Every time the user logs in, the following should happen and in that order (at the time of user login) : 

  1.  read the existing value of last-logon-date property value and set this in a cookie or in the session object. 
  2. After the above, update the last-logon-date with the timestamp of the current user login.

Hope this helps.

Avatar

Level 8

Hi @shikhasoni1 

 

I am assuming you need this on the publish instance and you are on AEM as a Cloud Service. One option could be to store it in the user's profile as a custom attribute as @Harwinder-singh mentioned above.

 

You would also need to make sure that the data synchronization and encapsulated token is enabled in the environment. https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/sites/authoring/...

 

Thanks

Narendra

Avatar

Community Advisor

Refer to this post to understand the approach to capture last logged in time of the user in Author-https://medium.com/tech-learnings/adobe-experience-manager-reporting-on-users-last-login-date-e20350...

Please test this in your local or dev instance including exception cases before enabling on higher environment

Regards

Albin

https://myprofile.albinsblog.com

 

 

Avatar

Administrator

@shikhasoni1 Did you find the suggestions helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni