You've already forked Epicnabbo-Catalogus-Updated-Daily
39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Rules\GoogleRecaptchaRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use RyanChandler\LaravelCloudflareTurnstile\Rules\Turnstile;
|
|
|
|
class RegisterFormRequest extends FormRequest
|
|
{
|
|
protected $errorBag = 'register';
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'username' => ['required', 'string', sprintf('regex:%s', setting('username_regex')), 'max:25', Rule::unique('users')],
|
|
'mail' => ['required', 'string', 'email', 'max:255', Rule::unique('users')],
|
|
'password' => ['required', 'string', 'confirmed', 'min:8'],
|
|
'terms' => ['required', 'accepted'],
|
|
'g-recaptcha-response' => [new GoogleRecaptchaRule],
|
|
'cf-turnstile-response' => [app(Turnstile::class)],
|
|
];
|
|
}
|
|
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
#[\Override]
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'g-recaptcha-response.required' => __('The Google recaptcha must be completed'),
|
|
'g-recaptcha-response.string' => __('The google recaptcha was submitted with an invalid type'),
|
|
];
|
|
}
|
|
}
|