mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 10:28:00 +00:00
Feat: Default SAML/LDAP organization slug
This commit is contained in:
@@ -16,7 +16,7 @@ import { useOauthTokenExchange, useSelectOrganization } from "@app/hooks/api";
|
|||||||
import { fetchOrganizations } from "@app/hooks/api/organization/queries";
|
import { fetchOrganizations } from "@app/hooks/api/organization/queries";
|
||||||
import { fetchMyPrivateKey } from "@app/hooks/api/users/queries";
|
import { fetchMyPrivateKey } from "@app/hooks/api/users/queries";
|
||||||
|
|
||||||
import { navigateUserToOrg, navigateUserToSelectOrg } from "../../Login.utils";
|
import { navigateUserToOrg, useNavigateToSelectOrganization } from "../../Login.utils";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
providerAuthToken: string;
|
providerAuthToken: string;
|
||||||
@@ -39,8 +39,11 @@ export const PasswordStep = ({
|
|||||||
const { mutateAsync: selectOrganization } = useSelectOrganization();
|
const { mutateAsync: selectOrganization } = useSelectOrganization();
|
||||||
const { mutateAsync: oauthTokenExchange } = useOauthTokenExchange();
|
const { mutateAsync: oauthTokenExchange } = useOauthTokenExchange();
|
||||||
|
|
||||||
const { callbackPort, organizationId, hasExchangedPrivateKey } =
|
const { navigateToSelectOrganization } = useNavigateToSelectOrganization();
|
||||||
jwt_decode(providerAuthToken) as any;
|
|
||||||
|
const { callbackPort, organizationId, hasExchangedPrivateKey } = jwt_decode(
|
||||||
|
providerAuthToken
|
||||||
|
) as any;
|
||||||
|
|
||||||
const handleExchange = async () => {
|
const handleExchange = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -92,7 +95,7 @@ export const PasswordStep = ({
|
|||||||
|
|
||||||
// case: user has orgs, so we navigate the user to select an org
|
// case: user has orgs, so we navigate the user to select an org
|
||||||
if (userOrgs.length > 0) {
|
if (userOrgs.length > 0) {
|
||||||
navigateUserToSelectOrg(router, callbackPort);
|
navigateToSelectOrganization(callbackPort);
|
||||||
}
|
}
|
||||||
// case: no orgs found, so we navigate the user to create an org
|
// case: no orgs found, so we navigate the user to create an org
|
||||||
else {
|
else {
|
||||||
@@ -176,7 +179,7 @@ export const PasswordStep = ({
|
|||||||
|
|
||||||
// case: user has orgs, so we navigate the user to select an org
|
// case: user has orgs, so we navigate the user to select an org
|
||||||
if (userOrgs.length > 0) {
|
if (userOrgs.length > 0) {
|
||||||
navigateUserToSelectOrg(router, callbackPort);
|
navigateToSelectOrganization(callbackPort);
|
||||||
}
|
}
|
||||||
// case: no orgs found, so we navigate the user to create an org
|
// case: no orgs found, so we navigate the user to create an org
|
||||||
else {
|
else {
|
||||||
@@ -220,7 +223,7 @@ export const PasswordStep = ({
|
|||||||
const userOrgs = await fetchOrganizations();
|
const userOrgs = await fetchOrganizations();
|
||||||
|
|
||||||
if (userOrgs.length > 0) {
|
if (userOrgs.length > 0) {
|
||||||
navigateUserToSelectOrg(router);
|
navigateToSelectOrganization();
|
||||||
} else {
|
} else {
|
||||||
await navigateUserToOrg(router);
|
await navigateUserToOrg(router);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user