feat: allow custom app and generic oauth title

This commit is contained in:
Stavros
2025-02-23 20:51:56 +02:00
parent 7ee0b645e6
commit 30aab17f06
7 changed files with 69 additions and 34 deletions

View File

@@ -27,7 +27,7 @@ export const LoginPage = () => {
const params = new URLSearchParams(queryString);
const redirectUri = params.get("redirect_uri") ?? "";
const { isLoggedIn, configuredProviders } = useUserContext();
const { isLoggedIn, configuredProviders, title, genericName } = useUserContext();
const oauthProviders = configuredProviders.filter(
(value) => value !== "username",
@@ -111,7 +111,7 @@ export const LoginPage = () => {
return (
<Layout>
<Title ta="center">Tinyauth</Title>
<Title ta="center">{title}</Title>
<Paper shadow="md" p="xl" mt={30} radius="md" withBorder>
{oauthProviders.length > 0 && (
<>
@@ -175,7 +175,7 @@ export const LoginPage = () => {
onClick={() => loginOAuthMutation.mutate("generic")}
loading={loginOAuthMutation.isLoading}
>
Generic
{genericName}
</Button>
</Grid.Col>
)}

View File

@@ -8,7 +8,7 @@ import { Layout } from "../components/layouts/layout";
import { capitalize } from "../utils/utils";
export const LogoutPage = () => {
const { isLoggedIn, username, oauth, provider } = useUserContext();
const { isLoggedIn, username, oauth, provider, genericName } = useUserContext();
if (!isLoggedIn) {
return <Navigate to="/login" />;
@@ -45,7 +45,7 @@ export const LogoutPage = () => {
</Text>
<Text>
You are currently logged in as <Code>{username}</Code>
{oauth && ` using ${capitalize(provider)} OAuth`}. Click the button
{oauth && ` using ${capitalize(provider === "generic" ? genericName : provider)} OAuth`}. Click the button
below to log out.
</Text>
<Button

View File

@@ -7,6 +7,8 @@ export const userContextSchema = z.object({
provider: z.string(),
configuredProviders: z.array(z.string()),
disableContinue: z.boolean(),
title: z.string(),
genericName: z.string(),
});
export type UserContextSchemaType = z.infer<typeof userContextSchema>;