View .md

AuthEvent events

18 FeatherPanel plugin events on AuthEvent (18 emitted by the core): the event names, the arguments each listener gets, where they fire and a PHP listener for each.

Last synced from FeatherPanel 15b94e9 on .

On this page

Part of the plugin events reference. Listeners get the payload values as positional arguments in the order shown, cannot cancel the action, and must catch their own exceptions.

Setup

Import AuthEvent in your entry class and register listeners in processEvents():

<?php

namespace App\Addons\myplugin;

use App\App;
use App\Plugins\AppPlugin;
use App\Plugins\PluginEvents;
use App\Plugins\Events\Events\AuthEvent;

class MyPlugin implements AppPlugin
{
    public static function processEvents(PluginEvents $event): void
    {
        $event->on(AuthEvent::onAuthEmailLoginCodeRequested(), function ($user, $ipAddress): void {
            App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:email:login:code:requested ' . json_encode(['user' => $user, 'ip_address' => $ipAddress]));
        });
    }

    public static function pluginInstall(): void
    {
    }

    public static function pluginUninstall(): void
    {
    }
}

AuthEvent::onAuth2FAEnabled()

Name: featherpanel:auth:2fa:enabledemitted at 1 siteCancel or modify: nodefinition

Docblock: array user info.

#Payload keyListener parameterType
1user$userarrayfrom docblock
When it fires (1 site)
$event->on(AuthEvent::onAuth2FAEnabled(), function ($user): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:2fa:enabled ' . json_encode(['user' => $user]));
});

AuthEvent::onAuth2FAFailed()

Name: featherpanel:auth:2fa:failedemitted at 1 siteCancel or modify: nodefinition

Docblock: array user info. (the emitter passes 2 values, see the table)

#Payload keyListener parameterType
1user$usernot declared
2ip_address$ipAddressnot declared
When it fires (1 site)
$event->on(AuthEvent::onAuth2FAFailed(), function ($user, $ipAddress): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:2fa:failed');
});

AuthEvent::onAuth2FASetup()

Name: featherpanel:auth:2fa:setupemitted at 1 siteCancel or modify: nodefinition

Docblock: array user info.

#Payload keyListener parameterType
1user$userarrayfrom docblock
When it fires (1 site)
$event->on(AuthEvent::onAuth2FASetup(), function ($user): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:2fa:setup ' . json_encode(['user' => $user]));
});

AuthEvent::onAuth2FAVerified()

Name: featherpanel:auth:2fa:verifiedemitted at 1 siteCancel or modify: nodefinition

Docblock: array user info.

#Payload keyListener parameterType
1user$userarrayfrom docblock
When it fires (1 site)
$event->on(AuthEvent::onAuth2FAVerified(), function ($user): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:2fa:verified ' . json_encode(['user' => $user]));
});

AuthEvent::onAuthAccountLocked()

Name: featherpanel:auth:account:lockedemitted at 6 sites2 payload shapesCancel or modify: nodefinition

Docblock: array user info. (the emitter passes 3 values, see the table)

#Payload keyListener parameterType
1identifier$identifierstring
2lockout_seconds$lockoutSecondsint|null
3attempts$attemptsnot at every siteint
Arguments passedEmitted from
identifier, lockout_seconds, attempts
AccountLockoutHelper::reserveHardLockAttempt
AccountLockoutHelper::recordFailure
AccountLockoutHelper::recordFailure
AccountLockoutHelper::reserveHardLockAttemptViaFileStore
identifier, lockout_seconds, already_locked
AccountLockoutHelper::reserveHardLockAttempt
AccountLockoutHelper::reserveHardLockAttemptViaFileStore
When it fires (6 sites)
$event->on(AuthEvent::onAuthAccountLocked(), function ($identifier, $lockoutSeconds, ...$rest): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:account:locked ' . json_encode(['identifier' => $identifier, 'lockout_seconds' => $lockoutSeconds]));
});

AuthEvent::onAuthAccountUnlocked()

Name: featherpanel:auth:account:unlockedemitted at 2 sitesCancel or modify: nodefinition

Docblock: array user info.

#Payload keyListener parameterType
1identifier$identifierstring
When it fires (2 sites)
$event->on(AuthEvent::onAuthAccountUnlocked(), function ($identifier): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:account:unlocked ' . json_encode(['identifier' => $identifier]));
});

AuthEvent::onAuthEmailChanged()

Name: featherpanel:auth:email:changedemitted at 1 siteCancel or modify: nodefinition

Docblock: array user info, string email. (the emitter passes 4 values, see the table)

#Payload keyListener parameterType
1user_uuid$userUuidnot declared
2old_email$oldEmailnot declared
3new_email$newEmailnot declared
4ip_address$ipAddressnot declared
When it fires (1 site)
$event->on(AuthEvent::onAuthEmailChanged(), function ($userUuid, $oldEmail, $newEmail, $ipAddress): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:email:changed');
});

AuthEvent::onAuthEmailLoginCodeRequested()

Name: featherpanel:auth:email:login:code:requestedemitted at 1 siteCancel or modify: nodefinition

Docblock: array user info, string ip_address.

#Payload keyListener parameterType
1user$userarrayfrom docblock
2ip_address$ipAddressstringfrom docblock
When it fires (1 site)
$event->on(AuthEvent::onAuthEmailLoginCodeRequested(), function ($user, $ipAddress): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:email:login:code:requested ' . json_encode(['user' => $user, 'ip_address' => $ipAddress]));
});

AuthEvent::onAuthForgotPassword()

Name: featherpanel:auth:forgot:passwordemitted at 1 siteCancel or modify: nodefinition

Docblock: array user info, string reset_url, string reset_token. (the emitter passes 4 values, see the table)

#Payload keyListener parameterType
1user$usernot declared
2reset_url$resetUrlnot declared
3ip_address$ipAddressnot declared
4reset_token$resetTokennot declared
When it fires (1 site)
$event->on(AuthEvent::onAuthForgotPassword(), function ($user, $resetUrl, $ipAddress, $resetToken): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:forgot:password');
});

AuthEvent::onAuthForgotPasswordFailed()

Name: featherpanel:auth:forgot:password:failedemitted at 1 siteCancel or modify: nodefinition

Docblock: string email, string reason. (the emitter passes 3 values, see the table)

#Payload keyListener parameterType
1email$emailnot declared
2reason$reasonstring
3ip_address$ipAddressnot declared
When it fires (1 site)
$event->on(AuthEvent::onAuthForgotPasswordFailed(), function ($email, $reason, $ipAddress): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:forgot:password:failed ' . json_encode(['reason' => $reason]));
});

AuthEvent::onAuthLoginFailed()

Name: featherpanel:auth:login:failedemitted at 8 sites4 payload shapesCancel or modify: nodefinition

Docblock: positional values from the emitted payload in key insertion order (see PluginEvents::emit). Possible keys across emitters: email, error, ip_address, provider, reason, user, username, username_or_email. (the emitter passes 3 values, see the table)

#Payload keyListener parameterType
1user$usernot at every sitenot declared
2reason$reasonnot at every sitestring
3ip_address$ipAddressnot at every sitenot declared
Arguments passedEmitted from
user, reason, ip_address
EmailLoginController::requestCode
EmailLoginController::verifyCode
LdapController::login
LoginController::put
LoginController::put
email, reason, ip_address
EmailLoginController::requestCode
username, provider, reason, error, ip_address
LdapController::login
username_or_email, reason, ip_address
LoginController::put
When it fires (8 sites)
$event->on(AuthEvent::onAuthLoginFailed(), function (...$rest): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:login:failed');
});

AuthEvent::onAuthLoginSuccess()

Name: featherpanel:auth:login:successemitted at 3 sitesCancel or modify: nodefinition

Docblock: array user info.

#Payload keyListener parameterType
1user$userarray
When it fires (3 sites)
$event->on(AuthEvent::onAuthLoginSuccess(), function ($user): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:login:success ' . json_encode(['user' => $user]));
});

AuthEvent::onAuthLogout()

Name: featherpanel:auth:logoutemitted at 2 sitesCancel or modify: nodefinition

Docblock: array user info.

Emitted without a payload; the listener takes no arguments.

When it fires (2 sites)
$event->on(AuthEvent::onAuthLogout(), function (): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:logout');
});

AuthEvent::onAuthPasswordChanged()

Name: featherpanel:auth:password:changedemitted at 1 siteCancel or modify: nodefinition

Docblock: array user info. (the emitter passes 3 values, see the table)

#Payload keyListener parameterType
1user_uuid$userUuidnot declared
2user$usernot declared
3ip_address$ipAddressnot declared
When it fires (1 site)
$event->on(AuthEvent::onAuthPasswordChanged(), function ($userUuid, $user, $ipAddress): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:password:changed');
});

AuthEvent::onAuthPasswordResetFailed()

Name: featherpanel:auth:password:reset:failedemitted at 2 sitesCancel or modify: nodefinition

Docblock: string email, string reason. (the emitter passes 3 values, see the table)

#Payload keyListener parameterType
1token$tokennot declared
2reason$reasonstring
3ip_address$ipAddressnot declared
When it fires (2 sites)
$event->on(AuthEvent::onAuthPasswordResetFailed(), function ($token, $reason, $ipAddress): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:password:reset:failed ' . json_encode(['reason' => $reason]));
});

AuthEvent::onAuthRegisterSuccess()

Name: featherpanel:auth:register:successemitted at 1 siteCancel or modify: nodefinition

Docblock: array user info.

#Payload keyListener parameterType
1user$userarrayfrom docblock
When it fires (1 site)
$event->on(AuthEvent::onAuthRegisterSuccess(), function ($user): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:register:success ' . json_encode(['user' => $user]));
});

AuthEvent::onAuthRegistrationFailed()

Name: featherpanel:auth:registration:failedemitted at 7 sites2 payload shapesCancel or modify: nodefinition

Docblock: string email, string reason. (the emitter passes 4 values, see the table)

#Payload keyListener parameterType
1email$emailnot declared
2username$usernamenot declared
3reason$reasonstring
4ip_address$ipAddressnot declared
Arguments passedEmitted from
email, username, reason, ip_address
RegisterController::put
RegisterController::put
RegisterController::put
RegisterController::put
RegisterController::put
RegisterController::put
email, username, reason, ip_address, abuse_confidence_score
RegisterController::put
When it fires (7 sites)
$event->on(AuthEvent::onAuthRegistrationFailed(), function ($email, $username, $reason, $ipAddress, ...$rest): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:registration:failed ' . json_encode(['reason' => $reason]));
});

AuthEvent::onAuthResetPasswordSuccess()

Name: featherpanel:auth:reset:password:successemitted at 1 siteCancel or modify: nodefinition

Docblock: array user info.

#Payload keyListener parameterType
1user$userarrayfrom docblock
When it fires (1 site)
$event->on(AuthEvent::onAuthResetPasswordSuccess(), function ($user): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:auth:reset:password:success ' . json_encode(['user' => $user]));
});