getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.59k stars 1.41k forks source link

Is there a hook for logging in as admin or any other user? #1516

Closed notatamas closed 7 years ago

notatamas commented 7 years ago

I would like to log each login attempts and successful logins from the users. I guess it requires a custom plugin. Is there a hook I could use for this?

The plugin would run on each login or login attempt and write a new line in a specific log file.

flaviocopes commented 7 years ago

Any plugin can listen for the "onTask.login" event, and you can access the POST data. The event is not unique to Admin, it will fire for the frontend, too, so you need to detect if it's Admin or frontend login (if you have that feature enabled in your site)