setNewPassword

The setNewPassword hook is triggered after a new password has been set. It passes the user object and the encrypted password as arguments and does not expect a return value.

Parameters

  1. object $member

    Current front end user (either \Contao\Database\Result or \Contao\MemberModel) that changed their password.

  2. string $password

    The new password (not encrypted).

  3. \Contao\Module $module

    Calling front end module. Will be null in back end context.

Example

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

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

class SetNewPasswordListener implements ServiceAnnotationInterface
{
    /**
     * @Hook("setNewPassword")
     */
    public function onSetNewPassword($member, string $password, Module $module = null): void
    {
        // Do something …
    }
}

References