Open Closed

How to capture user last login date and time and dormant users in ABP #1757


User avatar
0
Repunjay created
  • ABP Framework version: v4.3.1
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace: We have a requirement to capture user last login date and time and dormant users (who have not logged into the system for xx days) status. Does ABP framework provides information out of the box? If not what is the way to capture this information? The information is required as part of Audit and compliance, so your inputs and direction is must to address this issue.
  • Is it something you can provide us quickly thru a hotfix release?
  • Steps to reproduce the issue:"

4 Answer(s)
  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi @repunjay, you can find the users login date and time by checking the Action (LoginSucceded) field of the Security Logs page.

    You can use IIdentitySecurityLogRepository to list it in your application service.

    Also you can use the IIdentitySecurityLogRepository to get your inactive (dormant) users in specified time-range. (Maybe you can get the logged out users (by specifying the action as Logout) and check the user logged in 'x' days)

  • User Avatar
    0
    Repunjay created

    Logout

    Hi, Thanks for your reply. However, this approach is not feasible for our requirement. What we need is -

    • A report with list of users present in the system with last login date and time. The management needs such kind of report on a need basis. Is there a way query this information and provide it for all the users in the system.

    • When I try to filter security logs by action as Logout, I don't see any results. Looks like the Logout action is not captured in Audit logs.

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi, Thanks for your reply. However, this approach is not feasible for our requirement. What we need is -

    A report with list of users present in the system with last login date and time. The management needs such kind of report on a need basis. Is there a way query this information and provide it for all the users in the system.

    When I try to filter security logs by action as Logout, I don't see any results. Looks like the Logout action is not captured in Audit logs.

    Hi @Repunjay,

    1-) There is not any build-in way to get list of users with last login date and time. You need to implement it by yourself. You can use IIdentitySecurityLogRepository. (You need to query AbpSecurityLogs table of your database by your needs.)

    • You can also completely rewrite the function of the security log.

    2-) Actually Logout action is captured. You can view it from Security Logs page. By the way, Audit logs and Security logs are two different things.

    • Security Logs page is used to search and view authentication related operations (login, logout, change password...) in the system.
    • Audit Logs provide documentary evidence of the sequence of activities that have affected at any time a specific operation, procedure, or event.

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v8.2.0-preview Updated on března 25, 2024, 15:11