postAuthenticate

The postAuthenticate hook is triggered after a user was authenticated. It passes the user object as argument and does not expect a return value.

Using the postAuthenticate hook has been deprecated and will no longer work in Contao 5.0.

Parameters

  1. \Contao\User $user

    The user (object) which just has been authenticated.

Example

// src/EventListener/PostAuthenticateListener.php
namespace App\EventListener;

use Contao\CoreBundle\ServiceAnnotation\Hook;
use Contao\User;
use Terminal42\ServiceAnnotationBundle\ServiceAnnotationInterface;

class PostAuthenticateListener implements ServiceAnnotationInterface
{
    /**
     * @Hook("postAuthenticate")
     */
    public function onPostAuthenticate(User $user): void
    {
        // Do something …
    }
}

References