first commit
This commit is contained in:
34
app/Http/Requests/Auth/ChangePasswordRequest.php
Normal file
34
app/Http/Requests/Auth/ChangePasswordRequest.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use App\Rules\PasswordNotReused;
|
||||
use App\Support\PasswordPolicy;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* Смена пароля с проверкой политики и истории (меры ИАФ.3).
|
||||
*/
|
||||
class ChangePasswordRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'current_password' => ['required', 'current_password'],
|
||||
'password' => [
|
||||
'required',
|
||||
'confirmed',
|
||||
PasswordPolicy::rule(),
|
||||
new PasswordNotReused($this->user()),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user