34 lines
1017 B
PHP
34 lines
1017 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api\Client;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rules\Password;
|
|
|
|
class ClientChangePasswordRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return auth('client')->check();
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'current_password' => 'required|string',
|
|
'password' => ['required', Password::min(10), 'confirmed', 'different:current_password'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'current_password.required' => 'Mật khẩu hiện tại là bắt buộc',
|
|
'password.required' => 'Mật khẩu mới là bắt buộc',
|
|
'password.min' => 'Mật khẩu mới phải có ít nhất 10 ký tự',
|
|
'password.confirmed' => 'Xác nhận mật khẩu không khớp',
|
|
'password.different' => 'Mật khẩu mới phải khác mật khẩu hiện tại',
|
|
];
|
|
}
|
|
}
|