mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 13:22:08 +00:00
Merge pull request #3531 from Infisical/feat/githubSsoDefaultOrganizationSetting
Add Github SSO users to default organization on signup
This commit is contained in:
@@ -107,6 +107,7 @@ export type CompleteAccountSignupDTO = CompleteAccountDTO & {
|
||||
providerAuthToken?: string;
|
||||
attributionSource?: string;
|
||||
organizationName: string;
|
||||
useDefaultOrg?: boolean;
|
||||
};
|
||||
|
||||
export type VerifySignupInviteDTO = {
|
||||
|
||||
@@ -235,7 +235,7 @@ export const OverviewPage = () => {
|
||||
Default organization
|
||||
</div>
|
||||
<div className="mb-4 max-w-sm text-sm text-mineshaft-400">
|
||||
Select the default organization you want to set for SAML/LDAP/OIDC based
|
||||
Select the default organization you want to set for SAML/LDAP/OIDC/Github
|
||||
logins. When selected, user logins will be automatically scoped to the
|
||||
selected organization.
|
||||
</div>
|
||||
|
||||
@@ -13,6 +13,7 @@ export const SignupSsoPage = () => {
|
||||
const { t } = useTranslation();
|
||||
const search = useSearch({ from: ROUTE_PATHS.Auth.SignUpSsoPage.id });
|
||||
const token = search.token as string;
|
||||
const defaultOrgAllowed = search.defaultOrgAllowed as boolean | undefined;
|
||||
|
||||
const [step, setStep] = useState(0);
|
||||
const [password, setPassword] = useState("");
|
||||
@@ -57,6 +58,7 @@ export const SignupSsoPage = () => {
|
||||
password={password}
|
||||
setPassword={setPassword}
|
||||
providerAuthToken={token}
|
||||
forceDefaultOrg={defaultOrgAllowed}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
|
||||
+8
-5
@@ -30,6 +30,7 @@ type Props = {
|
||||
name: string;
|
||||
providerOrganizationName: string;
|
||||
providerAuthToken?: string;
|
||||
forceDefaultOrg?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -51,7 +52,8 @@ export const UserInfoSSOStep = ({
|
||||
providerOrganizationName,
|
||||
password,
|
||||
setPassword,
|
||||
providerAuthToken
|
||||
providerAuthToken,
|
||||
forceDefaultOrg
|
||||
}: Props) => {
|
||||
const [nameError, setNameError] = useState(false);
|
||||
const [organizationName, setOrganizationName] = useState("");
|
||||
@@ -84,7 +86,7 @@ export const UserInfoSSOStep = ({
|
||||
} else {
|
||||
setNameError(false);
|
||||
}
|
||||
if (!organizationName) {
|
||||
if (!organizationName && !forceDefaultOrg) {
|
||||
setOrganizationNameError(true);
|
||||
errorCheck = true;
|
||||
} else {
|
||||
@@ -160,7 +162,8 @@ export const UserInfoSSOStep = ({
|
||||
salt: result.salt,
|
||||
verifier: result.verifier,
|
||||
organizationName,
|
||||
attributionSource
|
||||
attributionSource,
|
||||
useDefaultOrg: forceDefaultOrg
|
||||
});
|
||||
|
||||
// unset signup JWT token and set JWT token
|
||||
@@ -267,7 +270,7 @@ export const UserInfoSSOStep = ({
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
{providerOrganizationName === undefined && (
|
||||
{!forceDefaultOrg && providerOrganizationName === undefined && (
|
||||
<div className="relative z-0 flex w-full min-w-[20rem] flex-col items-center justify-end rounded-lg py-2 lg:w-1/6">
|
||||
<p className="mb-1 ml-1 w-full text-left text-sm font-medium text-bunker-300">
|
||||
Organization Name
|
||||
@@ -279,7 +282,7 @@ export const UserInfoSSOStep = ({
|
||||
isRequired
|
||||
className="h-12"
|
||||
maxLength={64}
|
||||
disabled
|
||||
isDisabled={forceDefaultOrg}
|
||||
/>
|
||||
{organizationNameError && (
|
||||
<p className="ml-1 mt-1 w-full text-left text-xs text-red-600">
|
||||
|
||||
@@ -5,7 +5,8 @@ import { z } from "zod";
|
||||
import { SignupSsoPage } from "./SignUpSsoPage";
|
||||
|
||||
const SignupSSOPageQueryParamsSchema = z.object({
|
||||
token: z.string()
|
||||
token: z.string(),
|
||||
defaultOrgAllowed: z.boolean().optional()
|
||||
});
|
||||
|
||||
export const Route = createFileRoute("/_restrict-login-signup/signup/sso")({
|
||||
|
||||
Reference in New Issue
Block a user