Files
City10/app/Http/Requests/LoginRequest.php
T
marcocosta10000 79d12fa2f4 feat: add City10 platform with Laravel 13, AI agents, 3D viewer, and LGPD compliance
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
2026-10-17 20:46:15 -03:00

67 lines
1.6 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\Validator;
/**
* Validates credentials submitted through the login form.
*/
class LoginRequest 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 [
'email' => ['required', 'email', 'max:255'],
'password' => ['required', 'string'],
'remember' => ['nullable', 'boolean'],
'captcha' => ['required', 'integer'],
];
}
/**
* Get custom messages for validation errors.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'captcha.required' => __('validation.captcha_required'),
'captcha.integer' => __('validation.captcha_required'),
];
}
/**
* 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'));
}
});
}
}