Files
OnlineJudge/account/urls/oj.py
yuetsh fda7515263 refactor: 移除注册验证码,删掉 pillow
验证码只剩注册一处调用方,一并去掉。

- UserRegisterAPI 的校验、UserRegisterSerializer 的 captcha 字段、
  发图的 captcha 路由
- utils/captcha/ 整个包删除,含 Menlo.ttc 和 timesbi.ttf 两个字体
- utils/shortcuts.py 的 img2base64(),唯一调用方是验证码视图
- 依赖删除 pillow(本地实测 PIL/ 5.9M + pillow.libs/ 14M)

注意:注册接口现在只有 SysOptions.allow_register 一个开关,没有限流,
throttling 目前只用在 SubmissionAPI 上。内网自用可以接受,站点若暴露到
公网需要补 IP 维度限流。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-05 23:48:00 -06:00

43 lines
1.5 KiB
Python

from django.urls import path
from ..views.oj import (
SSOAPI,
AvatarUploadAPI,
Metrics,
OpenAPIAppkeyAPI,
ProfileProblemDisplayIDRefreshAPI,
SessionManagementAPI,
UserActivityRankAPI,
UserChangeEmailAPI,
UserChangePasswordAPI,
UserLoginAPI,
UserLogoutAPI,
UsernameOrEmailCheck,
UserProblemRankAPI,
UserProfileAPI,
UserRankAPI,
UserRegisterAPI,
)
urlpatterns = [
path("login", UserLoginAPI.as_view()),
path("logout", UserLogoutAPI.as_view()),
path("register", UserRegisterAPI.as_view()),
path("change_password", UserChangePasswordAPI.as_view()), # DEPRECATED: 前端未调用
path("change_email", UserChangeEmailAPI.as_view()), # DEPRECATED: 前端未调用
path("check_username_or_email", UsernameOrEmailCheck.as_view()), # DEPRECATED: 前端未调用
path("profile", UserProfileAPI.as_view(), name="user_profile_api"),
path("profile/fresh_display_id", ProfileProblemDisplayIDRefreshAPI.as_view()),
path("metrics", Metrics.as_view()),
path("upload_avatar", AvatarUploadAPI.as_view()),
path("user_rank", UserRankAPI.as_view()),
path("user_activity_rank", UserActivityRankAPI.as_view()),
path("user_problem_rank", UserProblemRankAPI.as_view()),
path("sessions", SessionManagementAPI.as_view()), # DEPRECATED: 前端未调用
path(
"open_api_appkey", # DEPRECATED: 前端未调用
OpenAPIAppkeyAPI.as_view(),
),
path("sso", SSOAPI.as_view()), # DEPRECATED: 前端未调用
]