админка
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ChangePasswordRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'current_password' => ['required', 'string', 'max:32'],
|
||||
'password' => ['required', 'string', 'min:8', 'max:32', 'confirmed', 'regex:/^(?=.*[A-Za-z])(?=.*\d).+$/'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'current_password.required' => 'Укажи текущий пароль.',
|
||||
'current_password.max' => 'Текущий пароль не должен быть длиннее 32 символов.',
|
||||
'password.required' => 'Укажи новый пароль.',
|
||||
'password.min' => 'Новый пароль должен содержать минимум 8 символов.',
|
||||
'password.max' => 'Новый пароль не должен быть длиннее 32 символов.',
|
||||
'password.confirmed' => 'Подтверждение нового пароля не совпадает.',
|
||||
'password.regex' => 'Новый пароль должен содержать хотя бы одну букву и одну цифру.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CreateInviteCodesRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'quantity' => ['required', 'integer', 'min:1', 'max:50'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'quantity.required' => 'Укажи количество инвайт-кодов.',
|
||||
'quantity.integer' => 'Количество должно быть числом.',
|
||||
'quantity.min' => 'Нужно создать минимум один инвайт-код.',
|
||||
'quantity.max' => 'За один раз можно создать не больше 50 инвайт-кодов.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class LoginRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'username' => ['required', 'string', 'min:3', 'max:32', 'regex:/^[A-Za-z0-9]+$/'],
|
||||
'password' => ['required', 'string', 'min:3', 'max:32'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'username.required' => 'Укажи логин аккаунта.',
|
||||
'username.min' => 'Логин должен содержать минимум 3 символа.',
|
||||
'username.max' => 'Логин не должен быть длиннее 32 символов.',
|
||||
'username.regex' => 'Логин может содержать только латинские буквы и цифры.',
|
||||
'password.required' => 'Укажи пароль.',
|
||||
'password.min' => 'Пароль должен содержать минимум 3 символа.',
|
||||
'password.max' => 'Пароль не должен быть длиннее 32 символов.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ class RegisterGameAccountRequest extends FormRequest
|
||||
return [
|
||||
'username' => ['required', 'string', 'min:3', 'max:32', 'regex:/^[A-Za-z0-9]+$/'],
|
||||
'email' => ['required', 'string', 'email:rfc', 'max:255'],
|
||||
'invite_code' => ['required', 'string', 'min:6', 'max:32'],
|
||||
'password' => ['required', 'string', 'min:8', 'max:32', 'confirmed', 'regex:/^(?=.*[A-Za-z])(?=.*\d).+$/'],
|
||||
'terms' => ['accepted'],
|
||||
];
|
||||
@@ -39,6 +40,10 @@ class RegisterGameAccountRequest extends FormRequest
|
||||
'email.string' => 'Email должен быть строкой.',
|
||||
'email.email' => 'Укажи корректный email адрес.',
|
||||
'email.max' => 'Email не должен быть длиннее 255 символов.',
|
||||
'invite_code.required' => 'Укажи инвайт-код.',
|
||||
'invite_code.string' => 'Инвайт-код должен быть строкой.',
|
||||
'invite_code.min' => 'Инвайт-код выглядит слишком коротким.',
|
||||
'invite_code.max' => 'Инвайт-код выглядит слишком длинным.',
|
||||
'password.required' => 'Укажи пароль.',
|
||||
'password.string' => 'Пароль должен быть строкой.',
|
||||
'password.min' => 'Пароль должен содержать минимум 8 символов.',
|
||||
@@ -57,6 +62,7 @@ class RegisterGameAccountRequest extends FormRequest
|
||||
return [
|
||||
'username' => 'логин аккаунта',
|
||||
'email' => 'email',
|
||||
'invite_code' => 'инвайт-код',
|
||||
'password' => 'пароль',
|
||||
'terms' => 'правила',
|
||||
];
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateAccountAccessRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'gmlevel' => ['required', 'integer', Rule::in(array_keys(\App\Support\WowData::securityLevels()))],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'gmlevel.required' => 'Укажи уровень доступа.',
|
||||
'gmlevel.integer' => 'Уровень доступа должен быть числом.',
|
||||
'gmlevel.in' => 'Выбран недопустимый уровень доступа.',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user