diff --git a/src/routes/login/index.tsx b/src/routes/login/index.tsx index 89dd06f3..c8bcff33 100644 --- a/src/routes/login/index.tsx +++ b/src/routes/login/index.tsx @@ -12,10 +12,15 @@ import Divider from "@/components/Divider"; import Button from "@/components/styled/Button"; import Input from "@/components/styled/Input"; import StyledLabel from "@/components/styled/Label"; +import IconBack from "@/assets/icons/arrow.left.svg"; import MagicLinkLogin from "./MagicLinkLogin"; import SignUpLink from "./SignUpLink"; import SocialLoginButtons from "./SocialLoginButtons"; +const defaultInput = { + email: "", + password: "" +}; export default function LoginPage() { const serverName = useAppSelector((store) => store.server.name); const { t } = useTranslation("auth"); @@ -24,10 +29,7 @@ export default function LoginPage() { const [login, { isSuccess, isLoading, error }] = useLoginMutation(); const { data: loginConfig, isSuccess: loginConfigSuccess } = useGetLoginConfigQuery(); const [emailInputted, setEmailInputted] = useState(false); - const [input, setInput] = useState({ - email: "", - password: "" - }); + const [input, setInput] = useState(defaultInput); useEffect(() => { const query = new URLSearchParams(location.search); @@ -112,6 +114,10 @@ export default function LoginPage() { return { ...prev }; }); }; + const handleBack = () => { + setInput(defaultInput); + setEmailInputted(false); + }; const { email, password } = input; if (!loginConfigSuccess) return null; @@ -123,7 +129,14 @@ export default function LoginPage() { if (loadingSMTPStatus) return null; return (
-
+
+ {emailInputted && ( + + )}
} {!hideSocials && }
- {whoCanSignUp === "EveryOne" && !hideSocials && } + {whoCanSignUp === "EveryOne" && }
);