From 0073dffc28bab9bfefdefd07cf12c7728636d61f Mon Sep 17 00:00:00 2001 From: Leonid Nikitin Date: Sun, 2 Jul 2023 15:21:01 +0600 Subject: [PATCH] Implemented password validation rules in the AppServiceProvider class. Ensured passwords should be at least 8 characters long, contain a mix of uppercase, lowercase, and special characters. These rules apply only for the production environment. --- app/Providers/AppServiceProvider.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 4d778a2..cd4b73d 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -13,6 +13,7 @@ use App\Captcha\Images\Lines; use App\Services\Api\V1\CaptchaService; use Illuminate\Contracts\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Illuminate\Validation\Rules\Password; final class AppServiceProvider extends ServiceProvider { @@ -42,6 +43,16 @@ final class AppServiceProvider extends ServiceProvider */ public function boot(): void { - // + Password::defaults(function () { + $rule = Password::min(8); + + return $this->app->isProduction() + ? $rule->letters() + ->mixedCase() + ->numbers() + ->symbols() + ->uncompromised() + : $rule; + }); } }