- IP pool: sheet import (xlsx/csv) matched by address, bulk allocate/revoke with notification email (ip_allocated/ip_revoked), ip_pool_logs history. - Orders/invoices: Excel export on branded template (BrandedReportWriter), shared billing filters, order item service info in list responses. - Web design quote Excel export; activity log export. - Service attachments with copy-to-invoice; deployment invoice attachments. - Customer email attachments stored on disk and attached by path. - Admin password change endpoint; user.fullname backfill migration; orders.user_id backfill from logs. - Disable deploy workflow until CI/CD is set up. - Ignore stored customer email and service attachment uploads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
1.6 KiB
PHP
55 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Support\Facades\Hash;
|
|
use Illuminate\Validation\Rules\Password;
|
|
use Illuminate\Validation\Validator;
|
|
|
|
class UpdateAdminPasswordRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'current_password' => ['required', 'string'],
|
|
'password' => [
|
|
'required',
|
|
'string',
|
|
Password::min(10),
|
|
'confirmed',
|
|
'different:current_password',
|
|
],
|
|
];
|
|
}
|
|
|
|
public function after(): array
|
|
{
|
|
return [
|
|
function (Validator $validator): void {
|
|
$user = $this->user('admin');
|
|
|
|
if ($user && ! Hash::check((string) $this->input('current_password'), $user->password)) {
|
|
$validator->errors()->add('current_password', 'Mật khẩu hiện tại không chính xác.');
|
|
}
|
|
},
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'current_password.required' => 'Vui lòng nhập mật khẩu hiện tại.',
|
|
'password.required' => 'Vui lòng nhập mật khẩu mới.',
|
|
'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 mới không khớp.',
|
|
'password.different' => 'Mật khẩu mới phải khác mật khẩu hiện tại.',
|
|
];
|
|
}
|
|
}
|