From 4d4765cdf592c248bd0a72a7da2eac62889b1e24 Mon Sep 17 00:00:00 2001 From: Pablo Date: Mon, 14 Oct 2024 15:03:24 -0400 Subject: [PATCH] =?UTF-8?q?Atualiza=C3=A7=C3=A3o=20do=20comando=20de=20exp?= =?UTF-8?q?ira=C3=A7=C3=A3o=20e=20da=20documenta=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 22 +++++++++++++++++++ .../InvalidateExpiredPasswordsCommand.php | 6 ++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7868449..1dd991f 100644 --- a/README.md +++ b/README.md @@ -134,4 +134,26 @@ use \Illuminate\Support\Facades\Schedule; ... Schedule::call('ae3auth:invalidate-expired-passwords')->daily(); +``` + +8) Adicione o atributo de data de expiração para o usuário + +Adicione o atributo de data de expiração para o usuário + +```php +use App\Models\User; + +class User extends Authenticatable +{ + ... + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ + ... + 'password_expires_at' + ]; + ... ``` \ No newline at end of file diff --git a/src/app/Console/Commands/InvalidateExpiredPasswordsCommand.php b/src/app/Console/Commands/InvalidateExpiredPasswordsCommand.php index 0125f35..b66eead 100644 --- a/src/app/Console/Commands/InvalidateExpiredPasswordsCommand.php +++ b/src/app/Console/Commands/InvalidateExpiredPasswordsCommand.php @@ -14,7 +14,11 @@ class InvalidateExpiredPasswordsCommand extends Command { try { $userModel = config('ae3auth-config.user.user_model'); - $users = $userModel::whereDate(config('ae3auth-config.user.expires_password_column_name'), '<=', now())->get(); + $users = $userModel::whereDate( + config('ae3auth-config.user.expires_password_column_name'), '<=', now() + ) + ->orWhereNull(config('ae3auth-config.user.expires_password_column_name')) + ->get(); $forceChangePasswordColumnName = config('ae3auth-config.user.force_change_column_name'); \DB::beginTransaction(); $users->each(function ($user) use ($forceChangePasswordColumnName) {