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.
This commit is contained in:
parent
719d4c7f10
commit
0073dffc28
@ -13,6 +13,7 @@ use App\Captcha\Images\Lines;
|
|||||||
use App\Services\Api\V1\CaptchaService;
|
use App\Services\Api\V1\CaptchaService;
|
||||||
use Illuminate\Contracts\Foundation\Application;
|
use Illuminate\Contracts\Foundation\Application;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Illuminate\Validation\Rules\Password;
|
||||||
|
|
||||||
final class AppServiceProvider extends ServiceProvider
|
final class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@ -42,6 +43,16 @@ final class AppServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
//
|
Password::defaults(function () {
|
||||||
|
$rule = Password::min(8);
|
||||||
|
|
||||||
|
return $this->app->isProduction()
|
||||||
|
? $rule->letters()
|
||||||
|
->mixedCase()
|
||||||
|
->numbers()
|
||||||
|
->symbols()
|
||||||
|
->uncompromised()
|
||||||
|
: $rule;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user