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