2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-05 00:39:32 +08:00
Files
panel/internal/http/request/user.go
Copilot 01a228f3ad feat: 实现登录验证码和安全入口错误页伪装功能 (#1206)
* Initial plan

* feat: 实现登录验证码和安全入口错误页伪装功能

- 后端:添加登录验证码功能(密码错误3次后触发)
- 后端:支持3种安全入口错误页伪装(418/nginx/close)
- 后端:添加验证码API和更新设置项
- 前端:登录页支持验证码输入和刷新
- 前端:设置页添加登录验证码和错误页伪装选项

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* fix: 修复代码审查问题

- hijack失败时回退到418错误页而非返回200
- 验证码输入去除空格

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* feat: 优化细节

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>
Co-authored-by: 耗子 <haozi@loli.email>
2026-01-10 05:21:09 +08:00

45 lines
1.4 KiB
Go

package request
type UserID struct {
ID uint `json:"id" validate:"required|exists:users,id"`
}
type UserLogin struct {
Username string `json:"username" validate:"required"` // encrypted with RSA-OAEP
Password string `json:"password" validate:"required"` // encrypted with RSA-OAEP
SafeLogin bool `json:"safe_login"`
PassCode string `json:"pass_code"` // 2FA
CaptchaCode string `json:"captcha_code"` // 验证码
}
type UserIsTwoFA struct {
Username string `query:"username" validate:"required"`
}
type UserCreate struct {
Username string `json:"username" validate:"required|notExists:users,username|regex:^[a-zA-Z0-9_-]+$"`
Password string `json:"password" validate:"required|password"`
Email string `json:"email" validate:"required|email"`
}
type UserUpdateUsername struct {
ID uint `json:"id" validate:"required|exists:users,id"`
Username string `json:"username" validate:"required|notExists:users,username|regex:^[a-zA-Z0-9_-]+$"`
}
type UserUpdatePassword struct {
ID uint `json:"id" validate:"required|exists:users,id"`
Password string `json:"password" validate:"required|password"`
}
type UserUpdateEmail struct {
ID uint `json:"id" validate:"required|exists:users,id"`
Email string `json:"email" validate:"required|email"`
}
type UserUpdateTwoFA struct {
ID uint `uri:"id" validate:"required|exists:users,id"`
Secret string `json:"secret"`
Code string `json:"code"`
}