Skip to content

Commit 179c4c3

Browse files
committed
wip
1 parent c2992f3 commit 179c4c3

28 files changed

+2687
-154
lines changed

.github/workflows/run-tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ jobs:
1414
matrix:
1515
os: [ubuntu-latest]
1616
php: [8.0, 8.1]
17-
laravel: [8.*]
17+
laravel: [8.*, 9.*]
1818
stability: [prefer-stable]
1919
include:
2020
- laravel: 8.*
2121
testbench: ^6.6
22+
- laravel: 9.*
23+
testbench: ^7.3
2224

2325
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
2426

@@ -44,4 +46,4 @@ jobs:
4446
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
4547
4648
- name: Execute tests
47-
run: vendor/bin/pest
49+
run: vendor/bin/phpunit

.php_cs.dist.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
return (new PhpCsFixer\Config())
1414
->setRules([
1515
'@PSR12' => true,
16+
'@PHP80Migration' => true,
17+
'@PHP80Migration:risky' => true,
18+
'declare_strict_types' => true,
1619
'array_syntax' => ['syntax' => 'short'],
1720
'ordered_imports' => ['sort_algorithm' => 'alpha'],
1821
'no_unused_imports' => true,

composer.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@
1717
"require": {
1818
"php": "^8.0",
1919
"spatie/laravel-package-tools": "^1.4.3",
20-
"illuminate/contracts": "^8.37"
20+
"illuminate/contracts": ">=8.37"
2121
},
2222
"require-dev": {
23-
"nunomaduro/collision": "^5.3",
24-
"orchestra/testbench": "^6.15",
25-
"pestphp/pest": "^1.18",
26-
"pestphp/pest-plugin-laravel": "^1.1",
27-
"spatie/laravel-ray": "^1.23",
28-
"vimeo/psalm": "^4.8"
23+
"nunomaduro/collision": "^6.0",
24+
"orchestra/testbench": "^7.0",
25+
"phpunit/phpunit": "^9.5"
2926
},
3027
"autoload": {
3128
"psr-4": {
@@ -38,7 +35,7 @@
3835
}
3936
},
4037
"scripts": {
41-
"test": "./vendor/bin/pest --no-coverage",
38+
"test": "./vendor/bin/phpunit --no-coverage",
4239
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
4340
},
4441
"config": {

config/auth-notifications.php

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,73 @@
22

33
use AlwaysOpen\AuthNotifications\Events\LoginWasChanged;
44
use AlwaysOpen\AuthNotifications\Events\PasswordWasChanged;
5+
use AlwaysOpen\AuthNotifications\Events\TwoFactorWasDisabled;
56
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;
615
use Illuminate\Auth\Events\Failed;
716
use Illuminate\Auth\Events\Lockout;
817
use Illuminate\Auth\Events\Validated;
918

1019
return [
20+
'user_model' => env('AUTH_NOTIFICATIONS_USER_MODEL', User::class),
21+
1122
'listen_to' => [
1223
// Laravel Auth Events
1324

1425
// 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+
],
1632

1733
// 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+
],
1940

2041
// 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+
],
2247

2348
// 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+
],
2873
],
2974
];

0 commit comments

Comments
 (0)