Files
portal-api/app/Http/Requests/Api/Client/ClientAuthRequest.php
baodev0andClaude Sonnet 5 12d5b4951c feat: popup quảng cáo, đặt lại mật khẩu bằng token 80 ký tự, 2FA email, vá lỗ hổng bảo mật
- Popup/banner quảng cáo cấu hình từ admin (loại, link, lịch hiển thị)
- Đặt lại mật khẩu: token 80 ký tự kèm check digit Luhn thay cho token+email lộ trong URL, chỉ lưu bản băm, một lần dùng, hết hạn 60 phút
- Xác thực 2 lớp qua email khi đăng nhập (mã 6 số, ghi nhớ thiết bị 90 ngày)
- ApiAuthCheck chặn ngay tài khoản bị khoá dù JWT còn hạn (trước đây dùng được tới hết TTL)
- Handler trả 404 thay vì 500 khi ModelNotFoundException không bọc HttpException
- Test ClientTamperingTest: xác nhận IDOR/giả mạo dữ liệu từ client đều bị chặn

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-13 13:23:33 +07:00

54 lines
1.1 KiB
PHP

<?php
namespace App\Http\Requests\Api\Client;
use Illuminate\Foundation\Http\FormRequest;
class ClientAuthRequest extends FormRequest
{
/**
* Allow request
*/
public function authorize(): bool
{
return true;
}
/**
* Validation rules
*/
public function rules(): array
{
return [
'email' => [
'required',
'email',
'exists:customers,email'
],
'password' => [
'required',
'string',
'min:6'
],
'device_token' => ['nullable', 'string', 'max:128'],
];
}
/**
* Custom messages (optional)
*/
public function messages(): array
{
return [
'email.required' => 'Email là bắt buộc',
'email.email' => 'Email không đúng định dạng',
'email.exists' => 'Email không tồn tại',
'password.required' => 'Mật khẩu là bắt buộc',
'password.min' => 'Mật khẩu tối thiểu 6 ký tự',
];
}
}