Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
本 PR 为系统增加了可配置的认证模式,并优化了登录页行为:
认证模式
新增后端环境变量:
AUTH_MODE支持以下取值:
oauth_requiredoauth_optionalsingle_user默认值:
AUTH_MODE=oauth_required环境变量
本次新增
AUTH_MODEstringoauth_requiredoauth_optionalsingle_user相关已有配置
GOOGLE_CLIENT_ID(string)GOOGLE_CLIENT_SECRET(string)GITHUB_CLIENT_ID(string)GITHUB_CLIENT_SECRET(string)AUTH_COOKIE_NAME(string)AUTH_COOKIE_SECURE(boolean)AUTH_SESSION_TTL_DAYS(integer)OAUTH_SESSION_COOKIE_NAME(string)FRONTEND_PUBLIC_URL(string)FRONTEND_DEFAULT_LANG(string)单用户默认配置
代码中保留默认值,不要求在
.env.example中显式配置:SINGLE_USER_ID,默认:defaultSINGLE_USER_NAME,默认:Local User主要实现
后端
/api/v1/auth/config接口,供前端获取当前认证配置primary_email,避免与 OAuth 用户邮箱冲突前端
/auth/config验证
已完成:
ruff check .python3 -m compileall backend/apppnpm lintpnpm build