Files
chatroom/app/Http/Requests/LoginRequest.php
lkddi ea06328885 功能:字体颜色持久化、等级体系升级至99级、钓鱼小游戏、补充系统参数
- 字体颜色:s_color 改为 varchar,发消息时保存颜色,进入聊天室自动恢复
- 等级体系:maxlevel 15→99,superlevel 16→100,99级经验阶梯(幂次曲线)
- 管理权限等级按比例调整:禁言50、踢人60、设公告60、封号80、封IP90
- 钓鱼小游戏:FishingController(抛竿扣金币+收竿随机结果+广播)
- 补充6个缺失的 sysparam 参数 + 4个钓鱼参数
- 用户列表点击用户名后自动聚焦输入框
- Pint 格式化
2026-02-26 21:10:34 +08:00

65 lines
1.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* 文件功能:登录/注册请求验证器
*
* @author ChatRoom Laravel
*
* @version 1.0.0
*/
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class LoginRequest extends FormRequest
{
/**
* 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, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'username' => [
'required',
'string',
'min:2',
'max:12',
// 允许中英文数字及常见符号但严格过滤可能引起XSS/SQL注入的危险字符< > ' "
'regex:/^[^<>\'"]+$/u',
],
'password' => ['required', 'string', 'min:1'],
'captcha' => ['required', 'captcha'],
];
}
/**
* 获取已定义验证规则的错误消息。
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'username.required' => '必须填写用户名。',
'username.min' => '用户名长度不得少于 2 个字符。',
'username.max' => '用户名长度不得超过 12 个字符。',
'username.regex' => '用户名包含非法字符(不允许使用尖括号或引号)。',
'password.required' => '必须填写密码。',
'password.min' => '密码长度不得少于 1 个字符。',
'captcha.required' => '必须填写验证码。',
'captcha.captcha' => '验证码不正确。',
];
}
}