2026-06-14 21:32:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Fo\Customer;
|
|
|
|
|
|
2026-11-10 14:28:00 +01:00
|
|
|
use App\Cqs\Actions\Crm\UpdateCustomerPasswordInput;
|
2026-06-14 21:32:07 +02:00
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
use Illuminate\Validation\Rules\Password;
|
|
|
|
|
use Infrastructure\Adapters\Services\AppCustomerAuthService;
|
|
|
|
|
|
|
|
|
|
class UpdatePasswordRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
public function __construct(
|
|
|
|
|
private readonly AppCustomerAuthService $authService
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function authorize(): bool
|
|
|
|
|
{
|
|
|
|
|
return $this->authService->check();
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-30 10:01:52 +02:00
|
|
|
public function toUpdateCustomerPasswordInput(): UpdateCustomerPasswordInput
|
|
|
|
|
{
|
|
|
|
|
return new UpdateCustomerPasswordInput(
|
|
|
|
|
$this->string('password_old')->value(),
|
|
|
|
|
$this->string('password')->value()
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-14 21:32:07 +02:00
|
|
|
/** @return array<string,mixed> */
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'password_old' => ['required'],
|
|
|
|
|
'password' => [
|
|
|
|
|
'required',
|
|
|
|
|
'required_with:password_confirmation',
|
|
|
|
|
'confirmed',
|
|
|
|
|
'max:255',
|
|
|
|
|
Password::min(8)
|
|
|
|
|
->mixedCase()
|
|
|
|
|
->letters()
|
|
|
|
|
->numbers()
|
|
|
|
|
->symbols()
|
|
|
|
|
->uncompromised(),
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|