diff --git a/CHANGELOG.md b/CHANGELOG.md index 534250191..0f53f4c22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. * **BREAKING CHANGE** Make Query\Builder return objects instead of array to match Laravel behavior by @GromNaN in [#3107](https://github.com/mongodb/laravel-mongodb/pull/3107) * **BREAKING CHANGE** In DB query results, convert BSON `UTCDateTime` objects into `Carbon` date with the default timezone by @GromNaN in [#3119](https://github.com/mongodb/laravel-mongodb/pull/3119) * Remove `MongoFailedJobProvider`, replaced by Laravel `DatabaseFailedJobProvider` by @GromNaN in [#3122](https://github.com/mongodb/laravel-mongodb/pull/3122) +* Remove custom `PasswordResetServiceProvider`, use the default `DatabaseTokenRepository` by @GromNaN in [#3124](https://github.com/mongodb/laravel-mongodb/pull/3124) * Remove `Blueprint::background()` method by @GromNaN in [#3132](https://github.com/mongodb/laravel-mongodb/pull/3132) ## [4.8.0] - 2024-08-27 diff --git a/src/Auth/DatabaseTokenRepository.php b/src/Auth/DatabaseTokenRepository.php deleted file mode 100644 index 83ce9bf6d..000000000 --- a/src/Auth/DatabaseTokenRepository.php +++ /dev/null @@ -1,59 +0,0 @@ - $email, - 'token' => $this->hasher->make($token), - 'created_at' => new UTCDateTime(Date::now()), - ]; - } - - /** @inheritdoc */ - protected function tokenExpired($createdAt) - { - $createdAt = $this->convertDateTime($createdAt); - - return parent::tokenExpired($createdAt); - } - - /** @inheritdoc */ - protected function tokenRecentlyCreated($createdAt) - { - $createdAt = $this->convertDateTime($createdAt); - - return parent::tokenRecentlyCreated($createdAt); - } - - private function convertDateTime($createdAt) - { - // Convert UTCDateTime to a date string. - if ($createdAt instanceof UTCDateTime) { - $date = $createdAt->toDateTime(); - $date->setTimezone(new DateTimeZone(date_default_timezone_get())); - $createdAt = $date->format('Y-m-d H:i:s'); - } elseif (is_array($createdAt) && isset($createdAt['date'])) { - $date = new DateTime($createdAt['date'], new DateTimeZone($createdAt['timezone'] ?? 'UTC')); - $date->setTimezone(new DateTimeZone(date_default_timezone_get())); - $createdAt = $date->format('Y-m-d H:i:s'); - } - - return $createdAt; - } -} diff --git a/src/Auth/PasswordBrokerManager.php b/src/Auth/PasswordBrokerManager.php deleted file mode 100644 index 157df3d97..000000000 --- a/src/Auth/PasswordBrokerManager.php +++ /dev/null @@ -1,23 +0,0 @@ -app['db']->connection(), - $this->app['hash'], - $config['table'], - $this->app['config']['app.key'], - $config['expire'], - $config['throttle'] ?? 0, - ); - } -} diff --git a/src/Auth/PasswordResetServiceProvider.php b/src/Auth/PasswordResetServiceProvider.php deleted file mode 100644 index a8aa61da4..000000000 --- a/src/Auth/PasswordResetServiceProvider.php +++ /dev/null @@ -1,22 +0,0 @@ -app->singleton('auth.password', function ($app) { - return new PasswordBrokerManager($app); - }); - - $this->app->bind('auth.password.broker', function ($app) { - return $app->make('auth.password')->broker(); - }); - } -} diff --git a/tests/TestCase.php b/tests/TestCase.php index 2353915ed..5f5bbecdc 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -4,32 +4,14 @@ namespace MongoDB\Laravel\Tests; -use Illuminate\Auth\Passwords\PasswordResetServiceProvider as BasePasswordResetServiceProviderAlias; use Illuminate\Foundation\Application; -use MongoDB\Laravel\Auth\PasswordResetServiceProvider; use MongoDB\Laravel\MongoDBServiceProvider; use MongoDB\Laravel\Tests\Models\User; use MongoDB\Laravel\Validation\ValidationServiceProvider; use Orchestra\Testbench\TestCase as OrchestraTestCase; -use function array_search; - class TestCase extends OrchestraTestCase { - /** - * Get application providers. - * - * @param Application $app - */ - protected function getApplicationProviders($app): array - { - $providers = parent::getApplicationProviders($app); - - unset($providers[array_search(BasePasswordResetServiceProviderAlias::class, $providers)]); - - return $providers; - } - /** * Get package providers. * @@ -39,7 +21,6 @@ protected function getPackageProviders($app): array { return [ MongoDBServiceProvider::class, - PasswordResetServiceProvider::class, ValidationServiceProvider::class, ]; }