mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-19 18:48:52 +00:00
[autofix.ci] apply automated fixes
This commit is contained in:
@@ -41,14 +41,19 @@ function parseOidcConfig(config: string | null): {
|
|||||||
} | null {
|
} | null {
|
||||||
if (!config) return null;
|
if (!config) return null;
|
||||||
try {
|
try {
|
||||||
const parsed = JSON.parse(config) as { clientId?: string; scopes?: string[] };
|
const parsed = JSON.parse(config) as {
|
||||||
|
clientId?: string;
|
||||||
|
scopes?: string[];
|
||||||
|
};
|
||||||
return { clientId: parsed.clientId, scopes: parsed.scopes };
|
return { clientId: parsed.clientId, scopes: parsed.scopes };
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseSamlConfig(config: string | null): { entryPoint?: string } | null {
|
function parseSamlConfig(
|
||||||
|
config: string | null,
|
||||||
|
): { entryPoint?: string } | null {
|
||||||
if (!config) return null;
|
if (!config) return null;
|
||||||
try {
|
try {
|
||||||
const parsed = JSON.parse(config) as { entryPoint?: string };
|
const parsed = JSON.parse(config) as { entryPoint?: string };
|
||||||
@@ -272,9 +277,7 @@ export function SSOSettings() {
|
|||||||
{detailsProvider.oidcConfig && (
|
{detailsProvider.oidcConfig && (
|
||||||
<>
|
<>
|
||||||
{(() => {
|
{(() => {
|
||||||
const oidc = parseOidcConfig(
|
const oidc = parseOidcConfig(detailsProvider.oidcConfig);
|
||||||
detailsProvider.oidcConfig,
|
|
||||||
);
|
|
||||||
if (!oidc) return null;
|
if (!oidc) return null;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -306,9 +309,7 @@ export function SSOSettings() {
|
|||||||
{detailsProvider.samlConfig && (
|
{detailsProvider.samlConfig && (
|
||||||
<>
|
<>
|
||||||
{(() => {
|
{(() => {
|
||||||
const saml = parseSamlConfig(
|
const saml = parseSamlConfig(detailsProvider.samlConfig);
|
||||||
detailsProvider.samlConfig,
|
|
||||||
);
|
|
||||||
if (!saml?.entryPoint) return null;
|
if (!saml?.entryPoint) return null;
|
||||||
return (
|
return (
|
||||||
<div className="grid gap-1">
|
<div className="grid gap-1">
|
||||||
|
|||||||
@@ -67,9 +67,12 @@ export default function Home({ IS_CLOUD }: Props) {
|
|||||||
const [isGithubLoading, setIsGithubLoading] = useState(false);
|
const [isGithubLoading, setIsGithubLoading] = useState(false);
|
||||||
const [isGoogleLoading, setIsGoogleLoading] = useState(false);
|
const [isGoogleLoading, setIsGoogleLoading] = useState(false);
|
||||||
const [isSSOLoading, setIsSSOLoading] = useState(false);
|
const [isSSOLoading, setIsSSOLoading] = useState(false);
|
||||||
const { data: ssoProviders } = api.sso.listLoginProviders.useQuery(undefined, {
|
const { data: ssoProviders } = api.sso.listLoginProviders.useQuery(
|
||||||
enabled: !IS_CLOUD,
|
undefined,
|
||||||
});
|
{
|
||||||
|
enabled: !IS_CLOUD,
|
||||||
|
},
|
||||||
|
);
|
||||||
const loginForm = useForm<LoginForm>({
|
const loginForm = useForm<LoginForm>({
|
||||||
resolver: zodResolver(LoginSchema),
|
resolver: zodResolver(LoginSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
@@ -298,34 +301,30 @@ export default function Home({ IS_CLOUD }: Props) {
|
|||||||
Sign in with Google
|
Sign in with Google
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{!IS_CLOUD &&
|
{!IS_CLOUD && ssoProviders && ssoProviders.length > 0 && (
|
||||||
ssoProviders &&
|
<div className="mb-4 space-y-2">
|
||||||
ssoProviders.length > 0 && (
|
<p className="text-center text-xs text-muted-foreground">
|
||||||
<div className="mb-4 space-y-2">
|
Sign in with SSO
|
||||||
<p className="text-center text-xs text-muted-foreground">
|
</p>
|
||||||
Sign in with SSO
|
<div className="flex flex-col gap-2">
|
||||||
</p>
|
{ssoProviders.map((provider) => (
|
||||||
<div className="flex flex-col gap-2">
|
<Button
|
||||||
{ssoProviders.map((provider) => (
|
key={provider.providerId}
|
||||||
<Button
|
variant="outline"
|
||||||
key={provider.providerId}
|
type="button"
|
||||||
variant="outline"
|
className="w-full"
|
||||||
type="button"
|
onClick={() => handleSSOSignIn(provider.providerId)}
|
||||||
className="w-full"
|
disabled={isSSOLoading}
|
||||||
onClick={() =>
|
>
|
||||||
handleSSOSignIn(provider.providerId)
|
<LogIn className="mr-2 size-4" />
|
||||||
}
|
Sign in with{" "}
|
||||||
disabled={isSSOLoading}
|
{provider.providerId.charAt(0).toUpperCase() +
|
||||||
>
|
provider.providerId.slice(1)}
|
||||||
<LogIn className="mr-2 size-4" />
|
</Button>
|
||||||
Sign in with{" "}
|
))}
|
||||||
{provider.providerId.charAt(0).toUpperCase() +
|
|
||||||
provider.providerId.slice(1)}
|
|
||||||
</Button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
|
)}
|
||||||
<Form {...loginForm}>
|
<Form {...loginForm}>
|
||||||
<form
|
<form
|
||||||
onSubmit={loginForm.handleSubmit(onSubmit)}
|
onSubmit={loginForm.handleSubmit(onSubmit)}
|
||||||
|
|||||||
Reference in New Issue
Block a user