2

Is there a User Event before the authentication is fired?

I want to show a message if the user doesn't have a password yet and if it's his first login / check if he never logged in before - All in the frontend.

If so, send the activation / set password email.

So i tried the EVENT_BEFORE_VALIDATE


 Event::on(
            Users::class,
            Users::EVENT_BEFORE_VALIDATE,
            function (UserEvent $event) {

Which returns nothing.

And the EVENT_BEFORE_AUTHENTICATE event. This seems to what i am searching for. But it seems that the event only fires if the user already has a password. If the user never logged in / has no password it seems that this Event is never fired.

Event::on(
            User::class,
            User::EVENT_BEFORE_AUTHENTICATE,
            function (AuthenticateUserEvent $event) {
                dd($event);
            }
        );
1
  • Also looking for this sort of behaviour. If you found a solution, workaround or differnt approach I''d love to hear it! 👍 Aug 1 '20 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.