Files
portal-api/app/Http/Requests/Api/Client/ClientRegisterRequest.php
T
baodev0andClaude Opus 5.5 e888a6ed5d feat: Turnstile captcha, menu khách + nút tắt topbar cấu hình từ admin, ẩn setting nhạy cảm
- Turnstile (App\Support\Turnstile, middleware turnstile) cho login admin và login/register/forgot/reset của khách; cấu hình ở setting key=turnstile, secret mã hoá SignRSA.
- Menu sidebar khách (setting client_menu) và nút tắt topbar (setting client_quick_links) do admin sửa qua administrator/client-menu[/quick-links], khách đọc v1/setting/menu, v1/setting/quick-links.
- v1/setting và settings/public chỉ trả whitelist PublicSetting::FIELDS (trước đây lộ bot_token, inet_api_key).
- Cài đặt tài khoản khách (preferences), rate limit theo IP cho register/resend-verify.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 15:53:43 +07:00

74 lines
1.8 KiB
PHP

<?php
namespace App\Http\Requests\Api\Client;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rules\Password;
class ClientRegisterRequest extends FormRequest
{
/**
* Allow request
*/
public function authorize(): bool
{
return true;
}
/**
* Validation rules
*/
public function rules(): array
{
return [
'fullname' => [
'required',
'string',
'max:255'
],
'phone' => [
'nullable',
'digits:10',
'unique:customers,phone'
],
'email' => [
'required',
'email',
'max:255',
'unique:customers,email'
],
'password' => [
'required',
Password::min(10),
'confirmed'
],
'trial_config' => [
'nullable',
'string',
],
];
}
/**
* Custom messages
*/
public function messages(): array
{
return [
'fullname.required' => 'Tên là bắt buộc',
'phone.digits' => 'Số điện thoại phải có 10 chữ số',
'phone.unique' => 'Số điện thoại đã tồn tại',
'email.required' => 'Email là bắt buộc',
'email.email' => 'Email không đúng định dạng',
'email.unique' => 'Email đã 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 10 ký tự',
'password.confirmed' => 'Xác nhận mật khẩu không khớp',
];
}
}