Initial commit of the complete City10 virtual city simulation platform. Backend (Laravel 13): - REST API with Sanctum tokens and session-based web authentication - Role-based access control (admin/user) with middleware protection - AI agent CRUD with OpenRouter.ai integration restricted to free models - Store management with 3D coordinates and AI shopkeeper assignment - Versioned legal documents (Terms, Privacy, Cookies) with LGPD audit trail - Math CAPTCHA on public forms and multi-language support (pt_BR, en, es) Frontend: - Responsive Blade templates with Tailwind CSS v4 - Three.js 3D city viewer with SSE chat streaming to AI agents - Admin panel for store and user administration Infrastructure: - MariaDB/MySQL database with comprehensive migrations - Database seeders for demo content and test accounts - PHPUnit test suite and Laravel Pint code styling - Vite build configuration with hot reload
57 lines
1.5 KiB
PHP
Executable File
57 lines
1.5 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Http\Requests\Traits\ValidatesMathCaptcha;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
use Illuminate\Validation\Rules\Password;
|
|
use Illuminate\Validation\Validator;
|
|
|
|
/**
|
|
* Validates new account registrations submitted through the public form.
|
|
*/
|
|
class RegisterRequest extends FormRequest
|
|
{
|
|
use ValidatesMathCaptcha;
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => ['required', 'string', 'max:120'],
|
|
'email' => ['required', 'string', 'email', 'max:255', Rule::unique('users', 'email')],
|
|
'password' => ['required', 'confirmed', Password::min(8)],
|
|
'locale' => ['nullable', Rule::in(['pt_BR', 'en', 'es'])],
|
|
'captcha' => ['required', 'integer'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Configure the validator instance.
|
|
*
|
|
* @param Validator $validator
|
|
*/
|
|
public function withValidator($validator): void
|
|
{
|
|
$validator->after(function ($validator): void {
|
|
if (! $this->validateMathCaptcha()) {
|
|
$validator->errors()->add('captcha', __('validation.captcha_failed'));
|
|
}
|
|
});
|
|
}
|
|
}
|