Looking for suggestions on how to subscribe to a login (I know I can use hook_user_login) when it's not "traditional". What I'm really looking for is to subscribe to anytime a user gets logged in via $ drush uli. Is there any way to tell HOW the user logged in?

  • 2
    I'd be tempted to add a route subscriber and hijack the route for /user/reset/{uid}/{timestamp}/{hash}/login, changing the callback to something under my own control. Then it's just a simple of matter of running your code in that callback, then calling the original controller method to finish up
    – Clive
    Commented Jan 10, 2018 at 16:09
  • Oh, great... I like that idea! Thank you. I suppose it wouldn't stop every method of logging in as a different user (you could use drush to change a users password), but I think that would accomplish 90% of what I want.
    – Dave
    Commented Jan 12, 2018 at 14:43


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.