From 5fa9966a4e6f613f17d524ccebbade85ff66540c Mon Sep 17 00:00:00 2001 From: "Apple\\Apple" Date: Wed, 4 Jun 2025 08:34:52 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Refactor:=20Conditionally=20render?= =?UTF-8?q?=20OAuth=20options=20in=20login=20and=20registration=20forms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit refactors the login and registration forms to enhance user experience by conditionally displaying OAuth-related UI elements. - In `LoginForm.js` and `RegisterForm.js`: - The "Other login/registration options" button and the "or" divider are now only displayed if at least one OAuth provider is enabled in the system settings. - This change ensures a cleaner interface when no OAuth options are configured, preventing user confusion. - In `RegisterForm.js`: - Changed `div` class from `relative` to `min-h-screen relative` to ensure the registration form an take up the entire screen height. --- web/src/components/auth/LoginForm.js | 38 +++++++++++-------- .../components/auth/PasswordResetConfirm.js | 2 +- web/src/components/auth/PasswordResetForm.js | 2 +- web/src/components/auth/RegisterForm.js | 36 ++++++++++-------- 4 files changed, 45 insertions(+), 33 deletions(-) diff --git a/web/src/components/auth/LoginForm.js b/web/src/components/auth/LoginForm.js index ec28dba8..1e92b5ff 100644 --- a/web/src/components/auth/LoginForm.js +++ b/web/src/components/auth/LoginForm.js @@ -442,21 +442,29 @@ const LoginForm = () => { - - {t('或')} - + {(status.github_oauth || status.oidc_enabled || status.wechat_login || status.linuxdo_oauth || status.telegram_oauth) && ( + <> + + {t('或')} + -
- +
+ +
+ + )} + +
+ {t('没有账户?')} {t('注册')}
@@ -503,7 +511,7 @@ const LoginForm = () => { }; return ( -
+
{/* 背景图片容器 - 放大并保持居中 */}
{ } return ( -
+
{/* 背景图片容器 - 放大并保持居中 */}
{ } return ( -
+
{/* 背景图片容器 - 放大并保持居中 */}
{
- - {t('或')} - + {(status.github_oauth || status.oidc_enabled || status.wechat_login || status.linuxdo_oauth || status.telegram_oauth) && ( + <> + + {t('或')} + -
- -
+
+ +
+ + )}
{t('已有账户?')} {t('登录')} @@ -549,7 +553,7 @@ const RegisterForm = () => { }; return ( -
+