From b397c58bab61016ed83f8d75e9732c19b76d8015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yuhan=20Guo=E4=B8=A8Eohan?= Date: Tue, 19 May 2026 16:14:34 +0800 Subject: [PATCH] fix(auth): expose register_enabled in /api/status and gate sign-up link (#4871) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /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 --- controller/misc.go | 2 ++ web/default/src/features/auth/sign-in/index.tsx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/controller/misc.go b/controller/misc.go index 29b3a5c5..344cda77 100644 --- a/controller/misc.go +++ b/controller/misc.go @@ -87,6 +87,8 @@ func GetStatus(c *gin.Context) { "chats": setting.Chats, "demo_site_enabled": operation_setting.DemoSiteEnabled, "self_use_mode_enabled": operation_setting.SelfUseModeEnabled, + "register_enabled": common.RegisterEnabled, + "password_register_enabled": common.PasswordRegisterEnabled, "default_use_auto_group": setting.DefaultUseAutoGroup, "usd_exchange_rate": operation_setting.USDExchangeRate, diff --git a/web/default/src/features/auth/sign-in/index.tsx b/web/default/src/features/auth/sign-in/index.tsx index f0fe0f0e..d9675c23 100644 --- a/web/default/src/features/auth/sign-in/index.tsx +++ b/web/default/src/features/auth/sign-in/index.tsx @@ -35,7 +35,7 @@ export function SignIn() {

{t('Sign in')}

- {!status?.self_use_mode_enabled && ( + {!status?.self_use_mode_enabled && status?.register_enabled !== false && (

{t("Don't have an account?")}{' '}