fix(auth): 添加密码登录注册功能开关控制 - #2787
Conversation
fix: Try to fix login error "already logged in" issue
fix: Use channel proxy settings for task query scenarios
fix: try to fix tool call issues
feat: add openai video remix endpoint
- Adjust sender field format, add space to separate nickname and email address - Ensure email header format complies with standard RFC specifications - Fix potential email client sending exceptions (Tencent Cloud)
* fix: 支持aws 通过全局参数透传或者渠道参数透传来 调用 * fix(aws): replace json.Unmarshal with common.Unmarshal for request body processing --------- Co-authored-by: r0 <liangchunlei@01.ai> Co-authored-by: CaIon <i@caion.me>
fix: health check
…group-retry feat(token): add cross-group retry option for token processing
fix: correct sender format issues fix QuantumNous#1347
feat(adaptor): add '-xhigh' suffix to reasoning effort options
…retry fix(channel_select): adjust priority retry logic for cross-group
…or channel selection
… and streaming support
…-tts feat: support gpt tts series model quota calculate
…ughpass feat: header passthrough
* fix: test using the correct path for rerank. * fix: The `input` parameter for testing responses uses an array to accommodate certain channels, such as Codex, which are incompatible with single strings.
* feat: channel affinity * feat: channel affinity -> model setting * fix: channel affinity * feat: channel affinity op * feat: channel_type setting * feat: clean * feat: cache supports both memory and Redis. * feat: Optimise ui/ux * feat: Optimise ui/ux * feat: Optimise codex usage ui/ux * feat: Optimise ui/ux * feat: Optimise ui/ux * feat: Optimise ui/ux * feat: If the affinitized channel fails and a retry succeeds on another channel, update the affinity to the successful channel
* feat: openai response /v1/response/compact * feat: /v1/response/compact bill * feat: /v1/response/compact * feat: /v1/responses/compact -> codex channel * feat: /v1/responses/compact -> codex channel * feat: /v1/responses/compact -> codex channel * feat: codex channel default models * feat: compact model price * feat: /v1/responses/comapct test
* feat: grok Usage Guidelines Violation Fee ui setting * feat: grok Usage Guidelines Violation Fee consume log * fix: grok Usage Guidelines Violation Fee log detail
…nes and vulnerability reporting
Updated the reporting method for security issues to include a link to the draft security advisory.
feat(gemini): map OpenAI stop to Gemini stopSequences
fix: remove disable_parallel_tool_use if tool_choice=none
…t-price fix: /v1/responses/compact default billing
* feat: 引入通用 HTTP BodyStorage/DiskCache 缓存配置与管理 - 新增 common/body_storage.go 提供 HTTP 请求体存储抽象和文件缓存能力 - 增加 common/disk_cache_config.go 支持全局磁盘缓存配置 - main.go 挂载缓存初始化流程 - 新增和补充 controller/performance.go (及 unix/windows) 用于缓存性能监控接口 - middleware/body_cleanup.go 自动清理缓存文件 - router 挂载相关接口 - 前端 settings 页面新增性能监控设置 PerformanceSetting - 优化缓存开关状态和模块热插拔能力 - 其他相关文件同步适配缓存扩展 * fix: 修复 BodyStorage 并发安全和错误处理问题 - 修复 diskStorage.Close() 竞态条件,先获取锁再执行 CAS - 为 memoryStorage 添加互斥锁和 closed 状态检查 - 修复 CreateBodyStorageFromReader 在磁盘存储失败时的回退逻辑 - 添加缓存命中统计调用 (IncrementDiskCacheHits/IncrementMemoryCacheHits) - 修复 gin.go 中 Seek 错误被忽略的问题 - 在 api-router 添加 BodyStorageCleanup 中间件 - 修复前端 formatBytes 对异常值的处理 Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
- 在 misc controller 中添加 password_login 和 password_register 配置项 - 为 LoginForm 组件添加密码登录按钮的条件渲染 - 为 RegisterForm 组件添加密码注册按钮的条件渲染 - 根据系统配置动态显示或隐藏相应的登录注册选项
WalkthroughBackend adds two boolean status flags: Changes
Sequence Diagram(s)sequenceDiagram
participant Browser
participant Frontend as WebApp
participant Backend
Browser->>Frontend: Load login/register page
Frontend->>Backend: GET /status
Backend-->>Frontend: { ..., password_login: bool, password_register: bool }
Frontend->>Browser: Render UI
alt password_login true
Frontend->>Browser: Show email/password login controls
else
Frontend->>Browser: Hide email/password login controls
end
alt password_register true
Frontend->>Browser: Show email/password registration controls
else
Frontend->>Browser: Hide email/password registration controls
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- 在 LoginForm 中添加对 password_login 状态的条件渲染控制 - 在 RegisterForm 中添加对 password_register 状态的条件渲染控制 - 确保 Divider 组件只在相应功能启用时显示 - 保持按钮和其他组件的条件渲染逻辑一致性
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/src/components/auth/RegisterForm.jsx (1)
751-761:⚠️ Potential issue | 🟡 MinorEdge case: email form renders even when
password_registeris disabled and no OAuth providers exist.When all OAuth providers are disabled, the fallback condition displays
renderEmailRegisterForm()regardless of thepassword_registerflag. The form will render but users cannot submit it (no backend check needed—the UX is broken). The same issue exists in LoginForm.jsx.Add
status.password_registerto the fallback condition to prevent the form from displaying when the feature is disabled:Suggested fix
{showEmailRegister || - !( + (!( status.github_oauth || status.discord_oauth || status.oidc_enabled || status.wechat_login || status.linuxdo_oauth || status.telegram_oauth - ) + ) && status.password_register) ? renderEmailRegisterForm() : renderOAuthOptions()}Apply the same fix to LoginForm.jsx (add
status.password_loginto the condition).
🧹 Nitpick comments (1)
web/src/components/auth/RegisterForm.jsx (1)
481-498: Consider combining the two adjacent conditionals.The logic correctly gates the Divider and registration button on
status.password_register. Since both blocks share the same condition, they could be combined into a single fragment to reduce duplication.♻️ Optional: Combine conditionals into a single fragment
- {status.password_register && ( - <Divider margin='12px' align='center'> - {t('或')} - </Divider> - )} - - {status.password_register && ( + {status.password_register && ( + <> + <Divider margin='12px' align='center'> + {t('或')} + </Divider> <Button theme='solid' type='primary' className='w-full h-12 flex items-center justify-center bg-black text-white !rounded-full hover:bg-gray-800 transition-colors' icon={<IconMail size='large' />} onClick={handleEmailRegisterClick} loading={emailRegisterLoading} > <span className='ml-3'>{t('使用 用户名 注册')}</span> </Button> + </> )}
- 添加了 hasShownRegisterDisabledError ref 来避免重复显示错误消息 - 实现了检查所有注册选项是否都被禁用的逻辑 - 当所有注册选项关闭时显示"管理员关闭了新用户注册"错误提示 - 修复了密码注册按钮显示条件,确保只有在密码注册启用时才显示 - 在登录和注册表单中将条件渲染改为 Fragment 包装以优化 JSX 结构
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@web/src/components/auth/LoginForm.jsx`:
- Around line 581-597: The email/password form is still rendered even when
status.password_login is false; update the LoginForm component to only
call/render renderEmailLoginForm() when status.password_login is true (same
check used for the Button block). Locate the renderEmailLoginForm invocation
inside LoginForm.jsx and wrap or gate it with a condition that checks
status.password_login (e.g., if (status.password_login) return
renderEmailLoginForm()), ensuring both the button and the full email/password
form follow the same flag.
| {status.password_login && ( | ||
| <> | ||
| <Divider margin='12px' align='center'> | ||
| {t('或')} | ||
| </Divider> | ||
| <Button | ||
| theme='solid' | ||
| type='primary' | ||
| className='w-full h-12 flex items-center justify-center bg-black text-white !rounded-full hover:bg-gray-800 transition-colors' | ||
| icon={<IconMail size='large' />} | ||
| onClick={handleEmailLoginClick} | ||
| loading={emailLoginLoading} | ||
| > | ||
| <span className='ml-3'>{t('使用 邮箱或用户名 登录')}</span> | ||
| </Button> | ||
| </> | ||
| )} |
There was a problem hiding this comment.
Password login can still be accessed when password_login is disabled.
This button is hidden, but the main render still shows the email/password form when no OAuth options exist, bypassing the flag. Gate renderEmailLoginForm() on status.password_login to enforce the config.
🔧 Suggested fix
- {showEmailLogin ||
- !(
- status.github_oauth ||
- status.discord_oauth ||
- status.oidc_enabled ||
- status.wechat_login ||
- status.linuxdo_oauth ||
- status.telegram_oauth
- )
- ? renderEmailLoginForm()
- : renderOAuthOptions()}
+ {status.password_login &&
+ (showEmailLogin ||
+ !(
+ status.github_oauth ||
+ status.discord_oauth ||
+ status.oidc_enabled ||
+ status.wechat_login ||
+ status.linuxdo_oauth ||
+ status.telegram_oauth
+ ))
+ ? renderEmailLoginForm()
+ : renderOAuthOptions()}🤖 Prompt for AI Agents
In `@web/src/components/auth/LoginForm.jsx` around lines 581 - 597, The
email/password form is still rendered even when status.password_login is false;
update the LoginForm component to only call/render renderEmailLoginForm() when
status.password_login is true (same check used for the Button block). Locate the
renderEmailLoginForm invocation inside LoginForm.jsx and wrap or gate it with a
condition that checks status.password_login (e.g., if (status.password_login)
return renderEmailLoginForm()), ensuring both the button and the full
email/password form follow the same flag.
- 将条件渲染中的重复代码块包装在Fragment中 - 统一登录表单中邮箱登录按钮的结构 - 统一注册表单中邮箱注册按钮的结构 - 移除多余的空行以改善代码可读性 - 保持现有功能不变的同时简化组件渲染逻辑
…n-password-disabled' into fix/register-username-option-when-password-disabled
- 移除未使用的 hasShownRegisterDisabledError 引用变量 - 删除检查注册选项状态的冗余代码逻辑 - 简化 OAuth 选项的条件判断表达式 - 修复密码注册功能的显示逻辑问题
fix #2719
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.