Skip to content

fix(auth): expose register_enabled in /api/status and gate sign-up link on login page - #4871

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
Gnonymous:fix/register-enabled-not-in-status
May 19, 2026
Merged

fix(auth): expose register_enabled in /api/status and gate sign-up link on login page#4871
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
Gnonymous:fix/register-enabled-not-in-status

Conversation

@Gnonymous

@Gnonymous Gnonymous commented May 15, 2026

Copy link
Copy Markdown
Contributor

Problem

/api/status never returned register_enabled or password_register_enabled, so the sign-in page could not react when an admin toggled the Registration Enabled setting in the admin panel.

The "Sign up" link on the login page was only gated on self_use_mode_enabled — a separate and unrelated concept (single-user self-hosted mode vs. multi-user deployment). This creates two concrete bugs:

  1. Registration disabled, link still visible: If RegisterEnabled = false but SelfUseModeEnabled = false, the "Sign up" link is shown. Users reach the sign-up page, fill in the form, and get a backend error — a confusing dead end.
  2. Registration enabled, link invisible: If RegisterEnabled = true but SelfUseModeEnabled = true (common after the setup wizard selects self-use mode), the link is permanently hidden regardless of the admin setting.

Root Cause

controller/misc.goGetStatus() builds the /api/status payload but omits register_enabled and password_register_enabled. The frontend type definitions (features/auth/types.ts) already declare these fields, but since the backend never sends them, they are always undefined at runtime and the sign-in page cannot use them.

Fix

controller/misc.go — expose two fields in the status response:

"register_enabled":          common.RegisterEnabled,
"password_register_enabled": common.PasswordRegisterEnabled,

web/default/src/features/auth/sign-in/index.tsx — gate the Sign Up link on both settings:

// before
{!status?.self_use_mode_enabled && (

// after
{!status?.self_use_mode_enabled && status?.register_enabled !== false && (

!== false (rather than === true) keeps the link visible for any client that has not yet received the new field (e.g. cached status), preserving backward compatibility.

Checklist

  • Backend: register_enabled and password_register_enabled now included in /api/status
  • Frontend: sign-in page respects register_enabled when deciding whether to show the Sign Up link
  • No new dependencies, no schema changes
  • Backward compatible — clients that do not receive the new fields default to showing the link (same behavior as before this fix)

🤖 Generated with Claude Code

Summary by CodeRabbit

Bug Fixes

  • Sign-in screen now correctly respects registration configuration settings when displaying the sign-up prompt.

Review Change Stack

/api/status never returned `register_enabled` or `password_register_enabled`,
so the sign-in page had no way to react when an admin disabled registration.
The "Sign up" link was only gated on `self_use_mode_enabled`, which is a
separate and unrelated concept (single-user vs. multi-user deployment).

Result: toggling "Registration Enabled" in admin settings had no visible
effect on the login page — users could still see the sign-up link even when
registration was disabled, and could not see it even when it was enabled
(if the system happened to be in self-use mode from initial setup).

Fix:
- Add `register_enabled` and `password_register_enabled` to GetStatus()
- Gate the "Sign up" link on `register_enabled !== false` in addition to
  the existing `!self_use_mode_enabled` check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c31638de-c15a-4c0d-b4ca-17fd51ec415b

📥 Commits

Reviewing files that changed from the base of the PR and between 18282e6 and 1f51774.

📒 Files selected for processing (2)
  • controller/misc.go
  • web/default/src/features/auth/sign-in/index.tsx

Walkthrough

The backend status endpoint now exposes two registration configuration fields to clients. The frontend sign-in screen uses one of these fields to conditionally show the signup prompt, restricting visibility when registration is disabled on the server.

Changes

Registration Configuration

Layer / File(s) Summary
Registration configuration exposure and sign-up visibility
controller/misc.go, web/default/src/features/auth/sign-in/index.tsx
GetStatus endpoint adds register_enabled and password_register_enabled fields to the response payload. The SignIn component conditionally renders the "Don't have an account? Sign up" prompt when status?.register_enabled !== false and !status?.self_use_mode_enabled.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A rabbit once set a gate,
With switches to control fate—
"Sign up here!" the prompt would say,
But only on a server's whim, hooray! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes both main changes: exposing register_enabled in the API status endpoint and gating the sign-up link based on this configuration.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Calcium-Ion Calcium-Ion left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Root cause and impact analysis are accurate:

  • /api/status previously omitted register_enabled / password_register_enabled, while the default frontend types already declared them, so they were silently undefined.
  • Gating the sign-up link on self_use_mode_enabled alone created two real dead-ends (registration disabled + link visible, registration enabled + link hidden under self-use).

Backend additions in controller/misc.go and the corresponding gate in web/default/src/features/auth/sign-in/index.tsx are minimal and consistent.

@Calcium-Ion
Calcium-Ion merged commit b397c58 into QuantumNous:main May 19, 2026
2 checks passed
reggie-lula pushed a commit to WhaleCrane/new-api-hz that referenced this pull request May 21, 2026
…nk (QuantumNous#4871)

/api/status never returned `register_enabled` or `password_register_enabled`,
so the sign-in page had no way to react when an admin disabled registration.
The "Sign up" link was only gated on `self_use_mode_enabled`, which is a
separate and unrelated concept (single-user vs. multi-user deployment).

Result: toggling "Registration Enabled" in admin settings had no visible
effect on the login page — users could still see the sign-up link even when
registration was disabled, and could not see it even when it was enabled
(if the system happened to be in self-use mode from initial setup).

Fix:
- Add `register_enabled` and `password_register_enabled` to GetStatus()
- Gate the "Sign up" link on `register_enabled !== false` in addition to
  the existing `!self_use_mode_enabled` check

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
yiranxiaohui added a commit to yiranxiaohui/new-api that referenced this pull request May 25, 2026
Range: 18282e6..3b9ed0a8 (upstream/main as of fetch)

Highlights:
- feat: support request_header key source (QuantumNous#4903)
- feat: Waffo Pancake gateway + admin catalog binding (QuantumNous#4935)
- perf: optimize request metadata extraction, drop dead batch
  helpers in relay/channel/openai/helper.go (QuantumNous#5009)
- perf: reduce heap residency for large base64 relay requests
- fix(channel): evict auto-disabled multi-key channels from cache (QuantumNous#4983)
- fix: resolve model owned_by from active channels (QuantumNous#4416) — introduces
  channelOwnerName/getPreferredModelOwners/buildOpenAIModel + ListModels refactor
- fix: GetAllChannels respects group filter (QuantumNous#4847, QuantumNous#4885)
- fix(auth): expose register_enabled, aff_code, localize reset (QuantumNous#4871, QuantumNous#4945, QuantumNous#4769)
- fix(webhook): processing + Waffo subscription compliance (QuantumNous#5047, QuantumNous#5038)
- refactor(ui): system settings drill-in sidebar + log filter responsiveness

Conflicts resolved:
- controller/model.go: kept local hiddenMappedModels filter
  (resolveAccessibleModelGroups + getHiddenMappedModelNamesForGroups)
  on top of upstream's ListModels refactor; adopted upstream
  channelOwnerName helper.
- relay/channel/openai/helper.go: adopted upstream (HEAD's
  processChatCompletions/processCompletions were dead code after
  upstream's perf refactor in QuantumNous#5009).

Local patches verified intact: Username + fillTopUpUsernames (model/topup.go,
locked by topup_username_test.go), HideUpstreamErrors, Claude developer-role
normalization, Gemini role fallback, Model Chat header nav entry,
channel affinity auto-clear.

Note: go build not run (no Go toolchain in this environment); CI to verify.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
xyfacai pushed a commit to xyfacai/new-api that referenced this pull request May 30, 2026
…nk (QuantumNous#4871)

/api/status never returned `register_enabled` or `password_register_enabled`,
so the sign-in page had no way to react when an admin disabled registration.
The "Sign up" link was only gated on `self_use_mode_enabled`, which is a
separate and unrelated concept (single-user vs. multi-user deployment).

Result: toggling "Registration Enabled" in admin settings had no visible
effect on the login page — users could still see the sign-up link even when
registration was disabled, and could not see it even when it was enabled
(if the system happened to be in self-use mode from initial setup).

Fix:
- Add `register_enabled` and `password_register_enabled` to GetStatus()
- Gate the "Sign up" link on `register_enabled !== false` in addition to
  the existing `!self_use_mode_enabled` check

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
isboyjc added a commit to isboyjc/amux-api that referenced this pull request May 31, 2026
Sync upstream QuantumNous/new-api, backend parts only:
- QuantumNous#4871 (b397c58): add register_enabled/password_register_enabled to
  GetStatus so the login page can react to admin registration toggle
- QuantumNous#4823 (032993e): add "slate" to validColors so it is not rejected
Skipped the web/default (new UI) frontend parts of both commits.
SamuelSxy pushed a commit to SamuelSxy/new-api-rh that referenced this pull request Jun 7, 2026
…nk (QuantumNous#4871)

/api/status never returned `register_enabled` or `password_register_enabled`,
so the sign-in page had no way to react when an admin disabled registration.
The "Sign up" link was only gated on `self_use_mode_enabled`, which is a
separate and unrelated concept (single-user vs. multi-user deployment).

Result: toggling "Registration Enabled" in admin settings had no visible
effect on the login page — users could still see the sign-up link even when
registration was disabled, and could not see it even when it was enabled
(if the system happened to be in self-use mode from initial setup).

Fix:
- Add `register_enabled` and `password_register_enabled` to GetStatus()
- Gate the "Sign up" link on `register_enabled !== false` in addition to
  the existing `!self_use_mode_enabled` check

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
fx247562340 pushed a commit to fx247562340/vancine-platform that referenced this pull request Jun 11, 2026
…nk (QuantumNous#4871)

/api/status never returned `register_enabled` or `password_register_enabled`,
so the sign-in page had no way to react when an admin disabled registration.
The "Sign up" link was only gated on `self_use_mode_enabled`, which is a
separate and unrelated concept (single-user vs. multi-user deployment).

Result: toggling "Registration Enabled" in admin settings had no visible
effect on the login page — users could still see the sign-up link even when
registration was disabled, and could not see it even when it was enabled
(if the system happened to be in self-use mode from initial setup).

Fix:
- Add `register_enabled` and `password_register_enabled` to GetStatus()
- Gate the "Sign up" link on `register_enabled !== false` in addition to
  the existing `!self_use_mode_enabled` check

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
330079598 pushed a commit to 330079598/new-api that referenced this pull request Aug 19, 2026
…nk (QuantumNous#4871)

/api/status never returned `register_enabled` or `password_register_enabled`,
so the sign-in page had no way to react when an admin disabled registration.
The "Sign up" link was only gated on `self_use_mode_enabled`, which is a
separate and unrelated concept (single-user vs. multi-user deployment).

Result: toggling "Registration Enabled" in admin settings had no visible
effect on the login page — users could still see the sign-up link even when
registration was disabled, and could not see it even when it was enabled
(if the system happened to be in self-use mode from initial setup).

Fix:
- Add `register_enabled` and `password_register_enabled` to GetStatus()
- Gate the "Sign up" link on `register_enabled !== false` in addition to
  the existing `!self_use_mode_enabled` check

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants