Jump to content

Recommended Posts

Posted

Hi,

With the introduction of GDPR regulations, many of our clients with "webuser" systems we've developed need a way to email users that haven't logged-in in a while (18 months seems to be the standard) to ask them if they still want their user account.

For most of the systems we've developed, we've added a field to the user template which records the time when the user logs in, so we'll be able to develop this functionality.

It got me thinking, would this be a welcome addition to the core, accessed in a similar way to created/modified dates e.g. $user->lastlogin?

Were it to be implemented, it would be useful to be able to 'silently login' if using $session->login($username, $pass) or $session->forceLogin($username), in the same way you can bypass save hooks by passing in an option to $pages->save().

Cheers,

Chris - NB Communication

  • Like 10
  • 10 months later...
  • 5 years later...
Posted

Thanks @bernhard!
Yesterday I was asking myself if my client has been active in the new system as promised and tried to find and filter a managerlog like in my CMS I used before PW. Now I installed ProcessLoginHistory for the future, but the passed data isn't there.
Having that functionality in the core from the installation on would make sense for this case, GDPR and system security in general.. in my opinion.

Otherwise or maybe anyway I have to use PW-profiles or similar for my new projects to have the basic extensions and customizations directly at hand.

  • Like 1
Posted
3 hours ago, sebibu said:

Having that functionality in the core from the installation on would make sense for this case, GDPR and system security in general.. in my opinion.

Hello @sebibu,

you can find successful or failed logins under "Setup => Logs => Session" (/processwire/setup/logs/view/session/). You can search those logs for example by username.

It should also be possible to search those logs with the API: https://processwire.com/api/ref/wire-log/get-entries/

Hope this helps. ?

Regards, Andreas

  • Like 2
  • Thanks 1
  • 2 weeks later...
Posted (edited)
On 5/22/2024 at 4:37 PM, bernhard said:

@sebibu you can easily hook into https://processwire.com/api/ref/session/login-success/ and add the last login timestamp as $page->meta('lastlogin', time()) on the $user object (for example).

As usual when I have a new idea and wonder how to implement it with PW core only, Bernhard has left a forum post pointing into the direction how to accomplish what I am looking for, even before I posted the question in the forum. I guess I own you a beer or two at least now. 

Edited by cwsoft
  • Haha 1
  • 10 months later...
Posted

Ok I just had that exact need and realised that once you realise it's too late to add a hook, because it will not work for the past, only for future logins ^^

So I support this request 😄 

And similar to what @nbcommunication wrote it might be helpful to have two different timestamps: one for the last manual login (done by a real user), one for the last API login (via code like forceLogin() or such)

  • Like 3

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...