mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-05-25 13:40:14 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 01581fc359 | |||
| 914e46f565 |
@@ -1,12 +1,12 @@
|
|||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardDescription,
|
CardContent,
|
||||||
CardFooter,
|
CardFooter,
|
||||||
CardHeader,
|
CardHeader,
|
||||||
CardTitle,
|
CardTitle,
|
||||||
} from "../ui/card";
|
} from "../ui/card";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../ui/button";
|
||||||
import { Trans, useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useLocation } from "react-router";
|
import { useLocation } from "react-router";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -24,23 +24,26 @@ export const DomainWarning = (props: Props) => {
|
|||||||
const redirectUri = searchParams.get("redirect_uri");
|
const redirectUri = searchParams.get("redirect_uri");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card role="alert" aria-live="assertive" className="min-w-xs sm:min-w-sm">
|
<Card role="alert" aria-live="assertive">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle className="text-3xl">{t("domainWarningTitle")}</CardTitle>
|
<CardTitle className="text-xl">{t("domainWarningTitle")}</CardTitle>
|
||||||
<CardDescription>
|
|
||||||
<Trans
|
|
||||||
t={t}
|
|
||||||
i18nKey="domainWarningSubtitle"
|
|
||||||
values={{ appUrl, currentUrl }}
|
|
||||||
components={{ code: <code /> }}
|
|
||||||
shouldUnescape={true}
|
|
||||||
/>
|
|
||||||
</CardDescription>
|
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardFooter className="flex flex-col items-stretch gap-2">
|
<CardContent className="flex flex-col gap-3 text-sm mb-1.25">
|
||||||
<Button onClick={onClick} variant="warning">
|
<p className="text-muted-foreground">{t("domainWarningSubtitle")}</p>
|
||||||
{t("ignoreTitle")}
|
<pre>
|
||||||
</Button>
|
<span className="text-muted-foreground">
|
||||||
|
{t("domainWarningExpected")}
|
||||||
|
<span className="text-primary">{appUrl}</span>
|
||||||
|
</span>
|
||||||
|
</pre>
|
||||||
|
<pre>
|
||||||
|
<span className="text-muted-foreground">
|
||||||
|
{t("domainWarningCurrent")}
|
||||||
|
<span className="text-primary">{currentUrl}</span>
|
||||||
|
</span>
|
||||||
|
</pre>
|
||||||
|
</CardContent>
|
||||||
|
<CardFooter className="flex flex-col items-stretch gap-3">
|
||||||
<Button
|
<Button
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
window.location.assign(
|
window.location.assign(
|
||||||
@@ -51,6 +54,9 @@ export const DomainWarning = (props: Props) => {
|
|||||||
>
|
>
|
||||||
{t("goToCorrectDomainTitle")}
|
{t("goToCorrectDomainTitle")}
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button onClick={onClick} variant="warning">
|
||||||
|
{t("ignoreTitle")}
|
||||||
|
</Button>
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const BaseLayout = ({ children }: { children: React.ReactNode }) => {
|
|||||||
<ThemeToggle />
|
<ThemeToggle />
|
||||||
<LanguageSelector />
|
<LanguageSelector />
|
||||||
</div>
|
</div>
|
||||||
<div className="max-w-sm">{children}</div>
|
<div className="max-w-sm md:min-w-sm min-w-xs">{children}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ code {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
@apply bg-accent border border-border rounded-md p-2 whitespace-break-spaces;
|
@apply bg-accent border border-border rounded-md p-2 whitespace-break-spaces break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lead {
|
.lead {
|
||||||
|
|||||||
@@ -57,7 +57,9 @@
|
|||||||
"fieldRequired": "This field is required",
|
"fieldRequired": "This field is required",
|
||||||
"invalidInput": "Invalid input",
|
"invalidInput": "Invalid input",
|
||||||
"domainWarningTitle": "Invalid Domain",
|
"domainWarningTitle": "Invalid Domain",
|
||||||
"domainWarningSubtitle": "This instance is configured to be accessed from <code>{{appUrl}}</code>, but <code>{{currentUrl}}</code> is being used. If you proceed, you may encounter issues with authentication.",
|
"domainWarningSubtitle": "You are accessing this instance from an incorrect domain. If you proceed, you may encounter issues with authentication.",
|
||||||
|
"domainWarningCurrent": "Current:",
|
||||||
|
"domainWarningExpected": "Expected:",
|
||||||
"ignoreTitle": "Ignore",
|
"ignoreTitle": "Ignore",
|
||||||
"goToCorrectDomainTitle": "Go to correct domain",
|
"goToCorrectDomainTitle": "Go to correct domain",
|
||||||
"authorizeTitle": "Authorize",
|
"authorizeTitle": "Authorize",
|
||||||
|
|||||||
@@ -57,7 +57,9 @@
|
|||||||
"fieldRequired": "This field is required",
|
"fieldRequired": "This field is required",
|
||||||
"invalidInput": "Invalid input",
|
"invalidInput": "Invalid input",
|
||||||
"domainWarningTitle": "Invalid Domain",
|
"domainWarningTitle": "Invalid Domain",
|
||||||
"domainWarningSubtitle": "This instance is configured to be accessed from <code>{{appUrl}}</code>, but <code>{{currentUrl}}</code> is being used. If you proceed, you may encounter issues with authentication.",
|
"domainWarningSubtitle": "You are accessing this instance from an incorrect domain. If you proceed, you may encounter issues with authentication.",
|
||||||
|
"domainWarningCurrent": "Current:",
|
||||||
|
"domainWarningExpected": "Expected:",
|
||||||
"ignoreTitle": "Ignore",
|
"ignoreTitle": "Ignore",
|
||||||
"goToCorrectDomainTitle": "Go to correct domain",
|
"goToCorrectDomainTitle": "Go to correct domain",
|
||||||
"authorizeTitle": "Authorize",
|
"authorizeTitle": "Authorize",
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ export const AuthorizePage = () => {
|
|||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader className="mb-2">
|
<CardHeader className="mb-2">
|
||||||
<div className="flex flex-col gap-3 items-center justify-center">
|
<div className="flex flex-col gap-3 items-center justify-center text-center">
|
||||||
<div className="bg-accent-foreground text-muted text-xl font-bold font-sans rounded-lg px-4 py-3">
|
<div className="bg-accent-foreground text-muted text-xl font-bold font-sans rounded-lg px-4 py-3">
|
||||||
{getClientInfo.data?.name.slice(0, 1)}
|
{getClientInfo.data?.name.slice(0, 1)}
|
||||||
</div>
|
</div>
|
||||||
@@ -163,7 +163,7 @@ export const AuthorizePage = () => {
|
|||||||
app: getClientInfo.data?.name || "Unknown",
|
app: getClientInfo.data?.name || "Unknown",
|
||||||
})}
|
})}
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<CardDescription className="text-sm max-w-sm text-center">
|
<CardDescription className="text-sm max-w-sm">
|
||||||
{scopes.includes("openid")
|
{scopes.includes("openid")
|
||||||
? t("authorizeSubtitle")
|
? t("authorizeSubtitle")
|
||||||
: t("authorizeSubtitleOAuth")}
|
: t("authorizeSubtitleOAuth")}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ export const ContinuePage = () => {
|
|||||||
if (showUntrustedWarning) {
|
if (showUntrustedWarning) {
|
||||||
return (
|
return (
|
||||||
<Card role="alert" aria-live="assertive">
|
<Card role="alert" aria-live="assertive">
|
||||||
<CardHeader>
|
<CardHeader className="gap-1.5">
|
||||||
<CardTitle className="text-xl">
|
<CardTitle className="text-xl">
|
||||||
{t("continueUntrustedRedirectTitle")}
|
{t("continueUntrustedRedirectTitle")}
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
@@ -133,8 +133,8 @@ export const ContinuePage = () => {
|
|||||||
if (showInsecureWarning) {
|
if (showInsecureWarning) {
|
||||||
return (
|
return (
|
||||||
<Card role="alert" aria-live="assertive">
|
<Card role="alert" aria-live="assertive">
|
||||||
<CardHeader>
|
<CardHeader className="gap-1.5">
|
||||||
<CardTitle className="text-3xl">
|
<CardTitle className="text-xl">
|
||||||
{t("continueInsecureRedirectTitle")}
|
{t("continueInsecureRedirectTitle")}
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
@@ -168,7 +168,7 @@ export const ContinuePage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="min-w-xs">
|
<Card>
|
||||||
<CardHeader className="gap-1.5">
|
<CardHeader className="gap-1.5">
|
||||||
<CardTitle className="text-xl">
|
<CardTitle className="text-xl">
|
||||||
{t("continueRedirectingTitle")}
|
{t("continueRedirectingTitle")}
|
||||||
@@ -176,8 +176,8 @@ export const ContinuePage = () => {
|
|||||||
<CardDescription>{t("continueRedirectingSubtitle")}</CardDescription>
|
<CardDescription>{t("continueRedirectingSubtitle")}</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
{showRedirectButton && (
|
{showRedirectButton && (
|
||||||
<CardFooter className="flex flex-col items-stretch">
|
<CardFooter>
|
||||||
<Button onClick={handleRedirect}>
|
<Button className="w-full" onClick={handleRedirect}>
|
||||||
{t("continueRedirectManually")}
|
{t("continueRedirectManually")}
|
||||||
</Button>
|
</Button>
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export const ErrorPage = () => {
|
|||||||
const error = searchParams.get("error") ?? "";
|
const error = searchParams.get("error") ?? "";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="min-w-xs">
|
<Card>
|
||||||
<CardHeader className="gap-1.5">
|
<CardHeader className="gap-1.5">
|
||||||
<CardTitle className="text-xl">{t("errorTitle")}</CardTitle>
|
<CardTitle className="text-xl">{t("errorTitle")}</CardTitle>
|
||||||
<CardDescription className="flex flex-col gap-3">
|
<CardDescription className="flex flex-col gap-3">
|
||||||
|
|||||||
@@ -2,16 +2,20 @@ import {
|
|||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
CardDescription,
|
CardDescription,
|
||||||
|
CardFooter,
|
||||||
CardHeader,
|
CardHeader,
|
||||||
CardTitle,
|
CardTitle,
|
||||||
} from "@/components/ui/card";
|
} from "@/components/ui/card";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
import { useAppContext } from "@/context/app-context";
|
import { useAppContext } from "@/context/app-context";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import Markdown from "react-markdown";
|
import Markdown from "react-markdown";
|
||||||
|
import { useNavigate } from "react-router";
|
||||||
|
|
||||||
export const ForgotPasswordPage = () => {
|
export const ForgotPasswordPage = () => {
|
||||||
const { forgotPasswordMessage } = useAppContext();
|
const { forgotPasswordMessage } = useAppContext();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
@@ -27,6 +31,17 @@ export const ForgotPasswordPage = () => {
|
|||||||
</Markdown>
|
</Markdown>
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
<CardFooter>
|
||||||
|
<Button
|
||||||
|
className="w-full"
|
||||||
|
variant="outline"
|
||||||
|
onClick={() => {
|
||||||
|
navigate("/login");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("notFoundButton")}
|
||||||
|
</Button>
|
||||||
|
</CardFooter>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ export const LoginPage = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Card className="md:min-w-sm">
|
<Card>
|
||||||
<CardHeader className="gap-1.5">
|
<CardHeader className="gap-1.5">
|
||||||
<CardTitle className="text-center text-xl">{title}</CardTitle>
|
<CardTitle className="text-center text-xl">{title}</CardTitle>
|
||||||
{providers.length > 0 && (
|
{providers.length > 0 && (
|
||||||
@@ -264,14 +264,16 @@ export const LoginPage = () => {
|
|||||||
)}
|
)}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardFooter>
|
<CardFooter>
|
||||||
<Button
|
{userAuthConfigured && (
|
||||||
className="w-full"
|
<Button
|
||||||
type="submit"
|
className="w-full"
|
||||||
form={formId}
|
type="submit"
|
||||||
loading={loginIsPending || oauthIsPending}
|
form={formId}
|
||||||
>
|
loading={loginIsPending || oauthIsPending}
|
||||||
{t("loginSubmit")}
|
>
|
||||||
</Button>
|
{t("loginSubmit")}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export const LogoutPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="min-w-xs">
|
<Card>
|
||||||
<CardHeader className="gap-1.5">
|
<CardHeader className="gap-1.5">
|
||||||
<CardTitle className="text-xl">{t("logoutTitle")}</CardTitle>
|
<CardTitle className="text-xl">{t("logoutTitle")}</CardTitle>
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
@@ -84,8 +84,10 @@ export const LogoutPage = () => {
|
|||||||
)}
|
)}
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardFooter className="flex flex-col items-stretch">
|
<CardFooter>
|
||||||
<Button
|
<Button
|
||||||
|
className="w-full"
|
||||||
|
variant="outline"
|
||||||
loading={logoutMutation.isPending}
|
loading={logoutMutation.isPending}
|
||||||
onClick={() => logoutMutation.mutate()}
|
onClick={() => logoutMutation.mutate()}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -21,13 +21,18 @@ export const NotFoundPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="min-w-xs">
|
<Card>
|
||||||
<CardHeader className="gap-1.5">
|
<CardHeader className="gap-1.5">
|
||||||
<CardTitle className="text-xl">{t("notFoundTitle")}</CardTitle>
|
<CardTitle className="text-xl">{t("notFoundTitle")}</CardTitle>
|
||||||
<CardDescription>{t("notFoundSubtitle")}</CardDescription>
|
<CardDescription>{t("notFoundSubtitle")}</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardFooter className="flex flex-col items-stretch">
|
<CardFooter>
|
||||||
<Button onClick={handleRedirect} loading={loading}>
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
className="w-full"
|
||||||
|
onClick={handleRedirect}
|
||||||
|
loading={loading}
|
||||||
|
>
|
||||||
{t("notFoundButton")}
|
{t("notFoundButton")}
|
||||||
</Button>
|
</Button>
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
|
|||||||
@@ -83,8 +83,13 @@ export const TotpPage = () => {
|
|||||||
onSubmit={(values) => totpMutation.mutate(values)}
|
onSubmit={(values) => totpMutation.mutate(values)}
|
||||||
/>
|
/>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardFooter className="flex flex-col items-stretch">
|
<CardFooter>
|
||||||
<Button form={formId} type="submit" loading={totpMutation.isPending}>
|
<Button
|
||||||
|
className="w-full"
|
||||||
|
form={formId}
|
||||||
|
type="submit"
|
||||||
|
loading={totpMutation.isPending}
|
||||||
|
>
|
||||||
{t("continueTitle")}
|
{t("continueTitle")}
|
||||||
</Button>
|
</Button>
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export const UnauthorizedPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="min-w-xs">
|
<Card>
|
||||||
<CardHeader className="gap-1.5">
|
<CardHeader className="gap-1.5">
|
||||||
<CardTitle className="text-xl">{t("unauthorizedTitle")}</CardTitle>
|
<CardTitle className="text-xl">{t("unauthorizedTitle")}</CardTitle>
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
@@ -65,8 +65,13 @@ export const UnauthorizedPage = () => {
|
|||||||
/>
|
/>
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardFooter className="flex flex-col items-stretch">
|
<CardFooter>
|
||||||
<Button onClick={handleRedirect} loading={loading}>
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
className="w-full"
|
||||||
|
onClick={handleRedirect}
|
||||||
|
loading={loading}
|
||||||
|
>
|
||||||
{t("unauthorizedButton")}
|
{t("unauthorizedButton")}
|
||||||
</Button>
|
</Button>
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
|
|||||||
Reference in New Issue
Block a user