2024-06-20 17:52:01 +05:30
|
|
|
import { observer } from "mobx-react";
|
|
|
|
|
import { useTheme } from "next-themes";
|
2025-07-02 19:43:44 +05:30
|
|
|
import { KeyRound, Mails } from "lucide-react";
|
2024-06-20 17:52:01 +05:30
|
|
|
// types
|
2025-10-13 21:07:49 +05:30
|
|
|
import type {
|
2024-07-02 12:58:45 +05:30
|
|
|
TGetBaseAuthenticationModeProps,
|
|
|
|
|
TInstanceAuthenticationMethodKeys,
|
|
|
|
|
TInstanceAuthenticationModes,
|
|
|
|
|
} from "@plane/types";
|
2025-07-02 19:43:44 +05:30
|
|
|
import { resolveGeneralTheme } from "@plane/utils";
|
2024-07-02 12:58:45 +05:30
|
|
|
// components
|
2025-11-06 00:09:35 -08:00
|
|
|
import giteaLogo from "@/app/assets/logos/gitea-logo.svg?url";
|
|
|
|
|
import githubLightModeImage from "@/app/assets/logos/github-black.png?url";
|
|
|
|
|
import githubDarkModeImage from "@/app/assets/logos/github-white.png?url";
|
|
|
|
|
import GitlabLogo from "@/app/assets/logos/gitlab-logo.svg?url";
|
|
|
|
|
import GoogleLogo from "@/app/assets/logos/google-logo.svg?url";
|
|
|
|
|
import OIDCLogo from "@/app/assets/logos/oidc-logo.svg?url";
|
|
|
|
|
import SAMLLogo from "@/app/assets/logos/saml-logo.svg?url";
|
2025-07-02 19:43:44 +05:30
|
|
|
import { AuthenticationMethodCard } from "@/components/authentication/authentication-method-card";
|
|
|
|
|
import { EmailCodesConfiguration } from "@/components/authentication/email-config-switch";
|
2025-10-28 18:53:54 +05:30
|
|
|
import { GiteaConfiguration } from "@/components/authentication/gitea-config";
|
2025-07-02 19:43:44 +05:30
|
|
|
import { GithubConfiguration } from "@/components/authentication/github-config";
|
|
|
|
|
import { GitlabConfiguration } from "@/components/authentication/gitlab-config";
|
|
|
|
|
import { GoogleConfiguration } from "@/components/authentication/google-config";
|
|
|
|
|
import { PasswordLoginConfiguration } from "@/components/authentication/password-config-switch";
|
2024-09-09 17:43:56 +05:30
|
|
|
// plane admin components
|
|
|
|
|
import { UpgradeButton } from "@/plane-admin/components/common";
|
2025-07-02 19:43:44 +05:30
|
|
|
// assets
|
2024-06-20 17:52:01 +05:30
|
|
|
|
|
|
|
|
export type TAuthenticationModeProps = {
|
|
|
|
|
disabled: boolean;
|
|
|
|
|
updateConfig: (key: TInstanceAuthenticationMethodKeys, value: string) => void;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Authentication methods
|
2024-07-02 12:58:45 +05:30
|
|
|
export const getAuthenticationModes: (props: TGetBaseAuthenticationModeProps) => TInstanceAuthenticationModes[] = ({
|
2024-06-20 17:52:01 +05:30
|
|
|
disabled,
|
|
|
|
|
updateConfig,
|
|
|
|
|
resolvedTheme,
|
|
|
|
|
}) => [
|
2025-07-02 19:43:44 +05:30
|
|
|
{
|
|
|
|
|
key: "unique-codes",
|
|
|
|
|
name: "Unique codes",
|
|
|
|
|
description:
|
|
|
|
|
"Log in or sign up for Plane using codes sent via email. You need to have set up SMTP to use this method.",
|
2025-12-12 20:50:14 +05:30
|
|
|
icon: <Mails className="h-6 w-6 p-0.5 text-tertiary/80" />,
|
2025-07-02 19:43:44 +05:30
|
|
|
config: <EmailCodesConfiguration disabled={disabled} updateConfig={updateConfig} />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "passwords-login",
|
|
|
|
|
name: "Passwords",
|
|
|
|
|
description: "Allow members to create accounts with passwords and use it with their email addresses to sign in.",
|
2025-12-12 20:50:14 +05:30
|
|
|
icon: <KeyRound className="h-6 w-6 p-0.5 text-tertiary/80" />,
|
2025-07-02 19:43:44 +05:30
|
|
|
config: <PasswordLoginConfiguration disabled={disabled} updateConfig={updateConfig} />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "google",
|
|
|
|
|
name: "Google",
|
|
|
|
|
description: "Allow members to log in or sign up for Plane with their Google accounts.",
|
2025-11-13 18:33:18 +05:30
|
|
|
icon: <img src={GoogleLogo} height={20} width={20} alt="Google Logo" />,
|
2025-07-02 19:43:44 +05:30
|
|
|
config: <GoogleConfiguration disabled={disabled} updateConfig={updateConfig} />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "github",
|
|
|
|
|
name: "GitHub",
|
|
|
|
|
description: "Allow members to log in or sign up for Plane with their GitHub accounts.",
|
|
|
|
|
icon: (
|
2025-11-13 18:33:18 +05:30
|
|
|
<img
|
2025-07-02 19:43:44 +05:30
|
|
|
src={resolveGeneralTheme(resolvedTheme) === "dark" ? githubDarkModeImage : githubLightModeImage}
|
|
|
|
|
height={20}
|
|
|
|
|
width={20}
|
|
|
|
|
alt="GitHub Logo"
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
config: <GithubConfiguration disabled={disabled} updateConfig={updateConfig} />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "gitlab",
|
|
|
|
|
name: "GitLab",
|
|
|
|
|
description: "Allow members to log in or sign up to plane with their GitLab accounts.",
|
2025-11-13 18:33:18 +05:30
|
|
|
icon: <img src={GitlabLogo} height={20} width={20} alt="GitLab Logo" />,
|
2025-07-02 19:43:44 +05:30
|
|
|
config: <GitlabConfiguration disabled={disabled} updateConfig={updateConfig} />,
|
|
|
|
|
},
|
2025-10-28 18:53:54 +05:30
|
|
|
{
|
|
|
|
|
key: "gitea",
|
|
|
|
|
name: "Gitea",
|
|
|
|
|
description: "Allow members to log in or sign up to plane with their Gitea accounts.",
|
2025-11-13 18:33:18 +05:30
|
|
|
icon: <img src={giteaLogo} height={20} width={20} alt="Gitea Logo" />,
|
2025-10-28 18:53:54 +05:30
|
|
|
config: <GiteaConfiguration disabled={disabled} updateConfig={updateConfig} />,
|
|
|
|
|
},
|
2024-09-09 17:43:56 +05:30
|
|
|
{
|
|
|
|
|
key: "oidc",
|
|
|
|
|
name: "OIDC",
|
|
|
|
|
description: "Authenticate your users via the OpenID Connect protocol.",
|
2025-11-13 18:33:18 +05:30
|
|
|
icon: <img src={OIDCLogo} height={22} width={22} alt="OIDC Logo" />,
|
2024-09-09 17:43:56 +05:30
|
|
|
config: <UpgradeButton />,
|
|
|
|
|
unavailable: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "saml",
|
|
|
|
|
name: "SAML",
|
|
|
|
|
description: "Authenticate your users via the Security Assertion Markup Language protocol.",
|
2025-11-13 18:33:18 +05:30
|
|
|
icon: <img src={SAMLLogo} height={22} width={22} alt="SAML Logo" className="pl-0.5" />,
|
2024-09-09 17:43:56 +05:30
|
|
|
config: <UpgradeButton />,
|
|
|
|
|
unavailable: true,
|
|
|
|
|
},
|
|
|
|
|
];
|
2024-06-20 17:52:01 +05:30
|
|
|
|
2025-11-20 19:09:40 +07:00
|
|
|
export const AuthenticationModes = observer(function AuthenticationModes(props: TAuthenticationModeProps) {
|
2024-06-20 17:52:01 +05:30
|
|
|
const { disabled, updateConfig } = props;
|
|
|
|
|
// next-themes
|
|
|
|
|
const { resolvedTheme } = useTheme();
|
|
|
|
|
|
|
|
|
|
return (
|
2025-12-12 20:50:14 +05:30
|
|
|
<div className="flex flex-col gap-3">
|
2024-06-20 17:52:01 +05:30
|
|
|
{getAuthenticationModes({ disabled, updateConfig, resolvedTheme }).map((method) => (
|
|
|
|
|
<AuthenticationMethodCard
|
|
|
|
|
key={method.key}
|
|
|
|
|
name={method.name}
|
|
|
|
|
description={method.description}
|
|
|
|
|
icon={method.icon}
|
|
|
|
|
config={method.config}
|
|
|
|
|
disabled={disabled}
|
2024-07-02 12:58:45 +05:30
|
|
|
unavailable={method.unavailable}
|
2024-06-20 17:52:01 +05:30
|
|
|
/>
|
|
|
|
|
))}
|
2025-12-12 20:50:14 +05:30
|
|
|
</div>
|
2024-06-20 17:52:01 +05:30
|
|
|
);
|
|
|
|
|
});
|