Commit Graph

4 Commits

Author SHA1 Message Date
TianyangZhang b6d5a51c3d fix: 邮箱字段设置为唯一且必填,改善错误提示
后端改动:
- User.email 设置为 unique=True,确保每个邮箱只能注册一次
- 这样 SendCodeView 能正确查找到已注册的邮箱

前端改动:
- LoginView 增加详细的错误日志输出
- 捕获更多错误信息类型帮助调试

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-25 16:09:48 +08:00
TianyangZhang 72e7244ea0 feat: 将注册手机号改为必填项 2026-03-25 15:46:44 +08:00
TianyangZhang 2edc9beef3 feat: 实现邮箱验证码登入功能
后端改动:
- 新增 VerificationCode 模型,支持验证码有效期和重试限制
- 新增 SendCodeView 生成并发送邮箱验证码
- 自定义 TokenObtainPairView 支持邮箱+验证码登入
- 添加 SendCodeSerializer 和 LoginSerializer

前端改动:
- 改写 LoginView.vue 为单页面邮箱+验证码登入流程
- 修改 auth API,新增 sendCode() 和修改 loginApi()
- 更新 auth store 的 login 方法支持邮箱和验证码

功能特性:
- 验证码有效期 10 分钟
- 同一邮箱 5 次错误尝试后锁定 10 分钟
- 支持重新发送验证码
- 完全替换原有用户名密码登入方式

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-25 15:30:23 +08:00
TianyangZhang c3466f4866 feat: add custom User model with role-based permissions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 17:11:40 +08:00