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) {