diff --git a/web/src/less/auth.less b/web/src/less/auth.less deleted file mode 100644 index d5406e96..00000000 --- a/web/src/less/auth.less +++ /dev/null @@ -1,75 +0,0 @@ -.page-wrapper.auth { - @apply flex flex-row justify-center items-center w-full h-full dark:bg-zinc-800; - - > .page-container { - @apply w-80 max-w-full h-full py-4 flex flex-col justify-start items-center; - - > .auth-form-wrapper { - @apply w-full py-4 grow flex flex-col justify-center items-center; - - > .page-header-container { - @apply flex flex-col justify-start items-start w-full mb-4; - - > .title-container { - @apply w-full flex flex-row justify-start items-center mb-2; - - > .logo-img { - @apply h-14 w-auto mr-1; - } - - > .logo-text { - @apply text-6xl tracking-wide text-black opacity-80 dark:text-gray-200; - } - } - - > .slogan-text { - @apply text-sm text-gray-700 dark:text-gray-300; - } - } - - > .page-content-container { - @apply flex flex-col justify-start items-start w-full; - - > .form-item-container { - @apply flex flex-col justify-start items-start relative w-full text-base mt-2; - - > .normal-text { - @apply absolute top-3 left-3 px-1 leading-10 flex-shrink-0 text-base cursor-text text-gray-400 bg-transparent transition-all select-none pointer-events-none; - - &.not-null { - @apply text-sm top-0 z-10 leading-4 bg-white dark:bg-zinc-800 rounded; - } - } - - &.input-form-container { - @apply py-2; - - > input { - @apply w-full py-3 px-3 text-base rounded-lg dark:bg-zinc-800; - } - } - } - - &.requesting { - @apply opacity-80; - } - } - - > .action-btns-container { - @apply flex flex-row justify-end items-center w-full mt-2; - - > .requesting { - @apply cursor-wait opacity-80; - } - } - - > .tip-text { - @apply w-full inline-block float-right text-sm mt-4 text-gray-500 text-right whitespace-pre-wrap; - - &.host-tip { - @apply text-blue-600; - } - } - } - } -} diff --git a/web/src/pages/Auth.tsx b/web/src/pages/Auth.tsx index 23f984ff..545821f7 100644 --- a/web/src/pages/Auth.tsx +++ b/web/src/pages/Auth.tsx @@ -9,7 +9,6 @@ import useLoading from "@/hooks/useLoading"; import Icon from "@/components/Icon"; import AppearanceSelect from "@/components/AppearanceSelect"; import LocaleSelect from "@/components/LocaleSelect"; -import "@/less/auth.less"; const Auth = () => { const { t } = useTranslation(); @@ -51,7 +50,20 @@ const Auth = () => { globalStore.setAppearance(appearance); }; + const handleFormSubmit = (e: React.FormEvent) => { + e.preventDefault(); + if (systemStatus?.host) { + handleSignInBtnClick(); + } else { + handleSignUpBtnsClick(); + } + }; + const handleSignInBtnClick = async () => { + if (username === "" || password === "") { + return; + } + if (actionBtnLoadingState.isLoading) { return; } @@ -73,6 +85,10 @@ const Auth = () => { }; const handleSignUpBtnsClick = async () => { + if (username === "" || password === "") { + return; + } + if (actionBtnLoadingState.isLoading) { return; } @@ -108,50 +124,88 @@ const Auth = () => { }; return ( -
-
-
-
-
+
+
+
+
+
-

{systemStatus.customizedProfile.name}

+

{systemStatus.customizedProfile.name}

-

{systemStatus.customizedProfile.description || t("slogan")}

+

{systemStatus.customizedProfile.description || t("slogan")}

-
-
- {t("common.username")} - +
+
+
+ + {t("common.username")} + + +
+
+ + {t("common.password")} + + +
-
- {t("common.password")} - +
+ {systemStatus?.host ? ( + <> + {actionBtnLoadingState.isLoading && } + {systemStatus?.allowSignUp && ( + <> + + / + + )} + + + ) : ( + <> + + + )}
-
-
- {systemStatus?.host ? ( - <> - {actionBtnLoadingState.isLoading && } - {systemStatus?.allowSignUp && ( - <> - - / - - )} - - - ) : ( - <> - - - )} -
+
{identityProviderList.length > 0 && ( <> or @@ -171,7 +225,11 @@ const Auth = () => {
)} - {!systemStatus?.host &&

{t("auth.host-tip")}

} + {!systemStatus?.host && ( +

+ {t("auth.host-tip")} +

+ )}