anteris-dev / laravel-security-notifications
当发生重大的安全事件时提醒用户,以便他们不会成为攻击者的下一个受害者。
Requires
- illuminate/contracts: ^8.55
- illuminate/notifications: ^8.55
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- orchestra/testbench: ^6.20
- phpunit/phpunit: ^9.5
- vimeo/psalm: ^4.9
This package is auto-updated.
Last update: 2024-09-19 05:53:35 UTC
README
此软件包在发生重大的安全事件时向用户添加安全通知,以便他们不会成为攻击者的下一个受害者。
警告邮箱变更
Anteris\LaravelSecurityNotifications\Concerns\WarnsOfEmailChanges
特性为您模型添加了一个 updatingEmail
事件,并在用户的邮箱更改时自动向用户发送通知。请注意,通知是发送到他们之前的邮箱,而不是更新的邮箱。
警告密码变更
Anteris\LaravelSecurityNotifications\Concerns\WarnsOfPasswordChanges
特性为您模型添加了一个 updatingPassword
事件,并在用户的密码更改时自动向用户发送通知。请注意,如果他们的邮箱同时更改,通知将发送到他们之前的邮箱,而不是更新的邮箱,以防攻击者试图更改邮箱。
警告双因素认证变更
Anteris\LaravelSecurityNotifications\Concerns\WarnsOfTwoFactorChanges
特性为您模型添加了一个 updatingTwoFactorSecret
事件,并在用户的双因素认证密钥更改时自动向用户发送通知。请注意,如果他们的邮箱同时更改,通知将发送到他们之前的邮箱,而不是更新的邮箱,以防攻击者试图更改邮箱。
配置属性
要配置模型上使用的属性以确定更改,使用以下命令发布配置文件
php artisan vendor:publish --provider="Anteris\LaravelSecurityNotifications\LaravelSecurityNotificationsServiceProvider" --tag=config
现在打开文件 config/laravel-security-notifications.php
并在 models
数组下为您的模型创建一条记录。例如
return [ 'models' => [ App\Models\User::class => [ 'email' => 'some_other_email_attribute', 'password' => 'some_other_password_attribute', 'two_factor_secret' => 'some_other_two_factor_attribute', ] ] ];
配置电子邮件
要修改发送给用户的电子邮件,运行以下命令发布 blade 文件
php artisan vendor:publish --provider="Anteris\LaravelSecurityNotifications\LaravelSecurityNotificationsServiceProvider" --tag=views
这将把 blade 文件放置在 resources/views/vendor/laravelSecurityNotifications
中。