always-open / laravel-auth-notifications
一个Laravel包,用于在用户的密码、两步验证或登录状态发生变化时通知他们。
Requires
- php: ^8.0
- illuminate/contracts: >=8.37
- spatie/laravel-package-tools: ^1.4.3
Requires (Dev)
- nunomaduro/collision: ^6.0
- orchestra/testbench: ^7.0
- phpunit/phpunit: ^9.5
README
一个Laravel包,用于在用户的密码、两步验证或登录状态发生变化时通知他们。
安装
您可以通过composer安装此包
composer require always-open/laravel-auth-notifications
您可以使用以下命令发布配置文件
php artisan vendor:publish --provider="AlwaysOpen\AuthNotifications\AuthNotificationsServiceProvider" --tag="laravel-auth-notifications-config"
用法
默认情况下,所有通知都处于关闭状态。要启用它们,声明适当的环境变量,例如 AUTH_NOTIFICATIONS_LOGIN_VALIDATED=true
。框架登录事件跟踪 Illuminate\Auth\Events\Validated
、Illuminate\Auth\Events\Failed
和 Illuminate\Auth\Events\Lockout
事件。
对于凭证通知,我们只是监视用户模型的更改。如果您想手动触发这些事件,将对应字段设置为空字符串,并使用仅参数为要发送的用户对象的 AlwaysOpen\AuthNotifications\Events\LoginWasChanged
、AlwaysOpen\AuthNotifications\Events\PasswordWasChanged
、AlwaysOpen\AuthNotifications\Events\TwoFactorWasEnabled
或 AlwaysOpen\AuthNotifications\Events\TwoFactorWasDisabled
进行触发。
您也可以通过创建自己的通知并覆盖 config/auth-notifications.php
中定义的类来覆盖发送的通知。使用 php artisan make:notification
创建自己的通知。
测试
composer test
贡献
有关详细信息,请参阅 CONTRIBUTING。
安全漏洞
请查看我们的安全策略以了解如何报告安全漏洞: 安全策略。
致谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅 许可证文件。