Counting number of successful logins #1296
Replies: 2 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
-
|
This doesn't sound like you want to count successful logins. Remember Me is a feature that maintains the session, which is to say the user never logged out, and thusly, never logged back in. What you're wanting to count sounds like active users or active sessions. That's something you could implement at the BaseController level or perhaps a Filter so that it happens on every request to your application. Even then this would be an estimate as you would have to define a certain period of time from when a request was issued to consider a user "active" on the site. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
Context
I would like to implement functionality to show the number of successful logins in my app. It is one of the engagement metrics my customers requested.
Challenge
Using existing Shield functionality (
auth_loginstable), this is straight forward for the cases where username/password, email/password and magic login was used to login.The same cannot be said for counting logins of users that chose to stay logged-in by selecting
rememberme. Or I have not found an elegant way to do it.Preliminary thoughts
The reason seems to be that Shield will call
Events::trigger('login', $user);on successful login in the first case, but there is no correspondingEvents::trigger('rememberMeLogin', $user);in the second case.For a first pass through the Session.php code, it seems that adding one line in the following implementation, would do the trick.
Why do I think this would work
Your help
Before I proceed, I would like to share this here and ask for your advice, to avoid going through a potential rabbit hole!
All comments welcome.
Thomas
Beta Was this translation helpful? Give feedback.
All reactions