|
2 | 2 |
|
3 | 3 | use AlwaysOpen\AuthNotifications\Events\LoginWasChanged;
|
4 | 4 | use AlwaysOpen\AuthNotifications\Events\PasswordWasChanged;
|
| 5 | +use AlwaysOpen\AuthNotifications\Events\TwoFactorWasDisabled; |
5 | 6 | use AlwaysOpen\AuthNotifications\Events\TwoFactorWasEnabled;
|
| 7 | +use AlwaysOpen\AuthNotifications\Notifications\Credentials\LoginChanged; |
| 8 | +use AlwaysOpen\AuthNotifications\Notifications\Credentials\PasswordChanged; |
| 9 | +use AlwaysOpen\AuthNotifications\Notifications\Credentials\TwoFactorDisabled; |
| 10 | +use AlwaysOpen\AuthNotifications\Notifications\Credentials\TwoFactorEnabled; |
| 11 | +use AlwaysOpen\AuthNotifications\Notifications\Login\Failed as LoginFailed; |
| 12 | +use AlwaysOpen\AuthNotifications\Notifications\Login\Lockout as LoginLockout; |
| 13 | +use AlwaysOpen\AuthNotifications\Notifications\Login\Validated as LoginValidated; |
| 14 | +use App\Models\User; |
6 | 15 | use Illuminate\Auth\Events\Failed;
|
7 | 16 | use Illuminate\Auth\Events\Lockout;
|
8 | 17 | use Illuminate\Auth\Events\Validated;
|
9 | 18 |
|
10 | 19 | return [
|
| 20 | + 'user_model' => env('AUTH_NOTIFICATIONS_USER_MODEL', User::class), |
| 21 | + |
11 | 22 | 'listen_to' => [
|
12 | 23 | // Laravel Auth Events
|
13 | 24 |
|
14 | 25 | // When the user's credentials are accepted at login
|
15 |
| - Validated::class, |
| 26 | + 'login_validated' => [ |
| 27 | + 'event' => Validated::class, |
| 28 | + 'enabled' => env('AUTH_NOTIFICATIONS_LOGIN_VALIDATED', false), |
| 29 | + 'notification' => LoginValidated::class, |
| 30 | + 'guards' => ['web'], |
| 31 | + ], |
16 | 32 |
|
17 | 33 | // When the user's credentials are rejected at login
|
18 |
| - Failed::class, |
| 34 | + 'login_failed' => [ |
| 35 | + 'event' => Failed::class, |
| 36 | + 'enabled' => env('AUTH_NOTIFICATIONS_LOGIN_FAILED', false), |
| 37 | + 'notification' => LoginFailed::class, |
| 38 | + 'guards' => ['web'], |
| 39 | + ], |
19 | 40 |
|
20 | 41 | // When the user is locked out for too many login attempts
|
21 |
| - Lockout::class, |
| 42 | + 'login_lockout' => [ |
| 43 | + 'event' => Lockout::class, |
| 44 | + 'enabled' => env('AUTH_NOTIFICATIONS_LOGIN_LOCKOUT', false), |
| 45 | + 'notification' => LoginLockout::class, |
| 46 | + ], |
22 | 47 |
|
23 | 48 | // Laravel Auth Notifications Custom Events
|
24 |
| - LoginWasChanged::class, |
25 |
| - PasswordWasChanged::class, |
26 |
| - TwoFactorWasEnabled::class, |
27 |
| - TwoFactorWasEnabled::class, |
| 49 | + 'login_changed' => [ |
| 50 | + 'event' => LoginWasChanged::class, |
| 51 | + 'enabled' => env('AUTH_NOTIFICATIONS_CREDENTIALS_LOGINCHANGED', false), |
| 52 | + 'notification' => LoginChanged::class, |
| 53 | + 'field' => 'email', |
| 54 | + ], |
| 55 | + 'password_changed' => [ |
| 56 | + 'event' => PasswordWasChanged::class, |
| 57 | + 'enabled' => env('AUTH_NOTIFICATIONS_CREDENTIALS_PASSWORDCHANGED', false), |
| 58 | + 'notification' => PasswordChanged::class, |
| 59 | + 'field' => 'password', |
| 60 | + ], |
| 61 | + 'twofactor_enabled' => [ |
| 62 | + 'event' => TwoFactorWasEnabled::class, |
| 63 | + 'enabled' => env('AUTH_NOTIFICATIONS_CREDENTIALS_TWOFACTORENABLED', false), |
| 64 | + 'notification' => TwoFactorEnabled::class, |
| 65 | + 'field' => 'two_factor_secret', |
| 66 | + ], |
| 67 | + 'twofactor_disabled' => [ |
| 68 | + 'event' => TwoFactorWasDisabled::class, |
| 69 | + 'enabled' => env('AUTH_NOTIFICATIONS_CREDENTIALS_TWOFACTORDISABLED', false), |
| 70 | + 'notification' => TwoFactorDisabled::class, |
| 71 | + 'field' => 'two_factor_secret', |
| 72 | + ], |
28 | 73 | ],
|
29 | 74 | ];
|
0 commit comments