diff --git a/app/scenes/Login/index.tsx b/app/scenes/Login/index.tsx
index bb7c54e66..751b4f16d 100644
--- a/app/scenes/Login/index.tsx
+++ b/app/scenes/Login/index.tsx
@@ -11,6 +11,7 @@ import ButtonLarge from "~/components/ButtonLarge";
import Fade from "~/components/Fade";
import Flex from "~/components/Flex";
import Heading from "~/components/Heading";
+import NoticeAlert from "~/components/NoticeAlert";
import OutlineLogo from "~/components/OutlineLogo";
import PageTitle from "~/components/PageTitle";
import TeamLogo from "~/components/TeamLogo";
@@ -23,10 +24,11 @@ import { changeLanguage, detectLanguage } from "~/utils/language";
import Notices from "./Notices";
import Provider from "./Provider";
-function Header({ config }: { config: Config }) {
+const isHosted = env.DEPLOYMENT === "hosted";
+
+function Header({ config }: { config?: Config | undefined }) {
const { t } = useTranslation();
- const isHosted = env.DEPLOYMENT === "hosted";
- const isSubdomain = !!config.hostname;
+ const isSubdomain = !!config?.hostname;
if (!isHosted || isCustomDomain()) {
return null;
@@ -53,6 +55,7 @@ function Login() {
const { t, i18n } = useTranslation();
const { auth } = useStores();
const { config } = auth;
+ const [error, setError] = React.useState(null);
const [emailLinkSentTo, setEmailLinkSentTo] = React.useState("");
const isCreate = location.pathname === "/create";
const handleReset = React.useCallback(() => {
@@ -63,7 +66,7 @@ function Login() {
}, []);
React.useEffect(() => {
- auth.fetchConfig();
+ auth.fetchConfig().catch(setError);
}, [auth]);
// TODO: Persist detected language to new user
@@ -92,7 +95,27 @@ function Login() {
return ;
}
- // we're counting on the config request being fast
+ if (error) {
+ return (
+
+
+
+
+
+ {t("Failed to load configuration.")}
+ {!isHosted && (
+
+ Check the network requests and server logs for full details of
+ the error.
+
+ )}
+
+
+
+ );
+ }
+
+ // we're counting on the config request being fast, so display nothing while waiting
if (!config) {
return null;
}
@@ -108,7 +131,7 @@ function Login() {
-
+ {t("Check your email")}
@@ -135,7 +158,7 @@ function Login() {
-
+
{env.TEAM_LOGO && env.DEPLOYMENT !== "hosted" ? (
diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json
index eea46e646..a036cc1ba 100644
--- a/shared/i18n/locales/en_US/translation.json
+++ b/shared/i18n/locales/en_US/translation.json
@@ -494,6 +494,8 @@
"Inline code": "Inline code",
"Back to home": "Back to home",
"Back to website": "Back to website",
+ "Login": "Login",
+ "Failed to load configuration.": "Failed to load configuration.",
"Check your email": "Check your email",
"A magic sign-in link has been sent to the email {{ emailLinkSentTo }}, no password needed.": "A magic sign-in link has been sent to the email {{ emailLinkSentTo }}, no password needed.",
"Back to login": "Back to login",