mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-26 21:11:48 +01:00
feat: disable creating account when server is not set
This commit is contained in:
parent
fcf42a4e8a
commit
130b4f5cc3
@ -55,6 +55,8 @@
|
||||
"text": "Did you configure it correctly?",
|
||||
"title": "Failed to reach server"
|
||||
},
|
||||
"noHostTitle": "Server not configured!",
|
||||
"noHost": "The server has not been configured, therefore you cannot create an account",
|
||||
"host": "You are connecting to <0>{{hostname}}</0> - please confirm you trust it before making an account",
|
||||
"no": "Go back",
|
||||
"title": "Do you trust this server?",
|
||||
|
@ -23,7 +23,7 @@ export function TrustBackendPart(props: TrustBackendPartProps) {
|
||||
const navigate = useNavigate();
|
||||
const backendUrl = useBackendUrl();
|
||||
const hostname = useMemo(
|
||||
() => (backendUrl ? new URL(backendUrl).hostname : ""),
|
||||
() => (backendUrl ? new URL(backendUrl).hostname : undefined),
|
||||
[backendUrl],
|
||||
);
|
||||
const result = useAsync(() => {
|
||||
@ -54,38 +54,52 @@ export function TrustBackendPart(props: TrustBackendPartProps) {
|
||||
return (
|
||||
<LargeCard>
|
||||
<LargeCardText
|
||||
title={t("auth.trust.title")}
|
||||
title={hostname ? t("auth.trust.title") : t("auth.trust.noHostTitle")}
|
||||
icon={<Icon icon={Icons.CIRCLE_EXCLAMATION} />}
|
||||
>
|
||||
<Trans
|
||||
i18nKey="auth.trust.host"
|
||||
values={{
|
||||
hostname,
|
||||
}}
|
||||
>
|
||||
<span className="text-white" />
|
||||
</Trans>
|
||||
{hostname ? (
|
||||
<Trans
|
||||
i18nKey="auth.trust.host"
|
||||
values={{
|
||||
hostname,
|
||||
}}
|
||||
>
|
||||
<span className="text-white" />
|
||||
</Trans>
|
||||
) : (
|
||||
<p>{t("auth.trust.noHost")}</p>
|
||||
)}
|
||||
</LargeCardText>
|
||||
|
||||
<div className="border border-authentication-border rounded-xl px-4 py-8 flex flex-col items-center space-y-2 my-8">
|
||||
{cardContent}
|
||||
</div>
|
||||
<LargeCardButtons>
|
||||
<Button theme="secondary" onClick={() => navigate("/")}>
|
||||
{t("auth.trust.no")}
|
||||
</Button>
|
||||
<Button
|
||||
theme="purple"
|
||||
onClick={() => result.value && props.onNext?.(result.value)}
|
||||
>
|
||||
{t("auth.trust.yes")}
|
||||
</Button>
|
||||
</LargeCardButtons>
|
||||
<p className="text-center mt-6">
|
||||
<Trans i18nKey="auth.hasAccount">
|
||||
<MwLink to="/login">.</MwLink>
|
||||
</Trans>
|
||||
</p>
|
||||
{hostname ? (
|
||||
<>
|
||||
<div className="border border-authentication-border rounded-xl px-4 py-8 flex flex-col items-center space-y-2 my-8">
|
||||
{cardContent}
|
||||
</div>
|
||||
<LargeCardButtons>
|
||||
<Button theme="secondary" onClick={() => navigate("/")}>
|
||||
{t("auth.trust.no")}
|
||||
</Button>
|
||||
<Button
|
||||
theme="purple"
|
||||
onClick={() => result.value && props.onNext?.(result.value)}
|
||||
>
|
||||
{t("auth.trust.yes")}
|
||||
</Button>
|
||||
</LargeCardButtons>
|
||||
<p className="text-center mt-6">
|
||||
<Trans i18nKey="auth.hasAccount">
|
||||
<MwLink to="/login">.</MwLink>
|
||||
</Trans>
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<LargeCardButtons>
|
||||
<Button theme="purple" onClick={() => navigate("/")}>
|
||||
{t("auth.trust.no")}
|
||||
</Button>
|
||||
</LargeCardButtons>
|
||||
)}
|
||||
</LargeCard>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user