Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not require tenant creation for SSO users #1411

Merged
merged 8 commits into from
Jan 7, 2025
40 changes: 40 additions & 0 deletions src/app/guards/TenantGuard/SsoUserMessage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Stack, Typography } from '@mui/material';
import FullPageWrapper from 'app/FullPageWrapper';
import AlertBox from 'components/shared/AlertBox';
import { useIntl } from 'react-intl';

function SsoUserMessage() {
const intl = useIntl();

return (
<FullPageWrapper fullWidth={true}>
travjenkins marked this conversation as resolved.
Show resolved Hide resolved
<AlertBox
short
severity="info"
title={intl.formatMessage({ id: 'tenant.usedSso.title' })}
>
<Stack spacing={1}>
<Typography>
{intl.formatMessage({ id: 'tenant.usedSso.message' })}
</Typography>

<Stack>
<Typography>
{intl.formatMessage({
id: 'tenant.usedSso.instructions1',
})}
</Typography>

<Typography>
{intl.formatMessage({
id: 'tenant.usedSso.instructions2',
})}
</Typography>
</Stack>
</Stack>
</AlertBox>
</FullPageWrapper>
);
}

export default SsoUserMessage;
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { useUserStore } from 'context/User/useUserContextStore';
import { useUserInfoSummaryStore } from 'context/UserInfoSummary/useUserInfoSummaryStore';
import useGlobalSearchParams, {
GlobalSearchParams,
} from 'hooks/searchParams/useGlobalSearchParams';
import { useMemo } from 'react';
import { BaseComponentProps } from 'types';
import OnboardGuard from './OnboardGuard';
import OnboardGuard from '../OnboardGuard';
import SsoUserMessage from './SsoUserMessage';

// This is a way to very simply "hide" the flow where anyone
// can create a tenant but allow us to test it out in prod.
Expand All @@ -21,9 +23,14 @@ function TenantGuard({ children }: BaseComponentProps) {

const hasAnyAccess = useUserInfoSummaryStore((state) => state.hasAnyAccess);
const mutate = useUserInfoSummaryStore((state) => state.mutate);
const usedSSO = useUserStore((state) => state.userDetails?.usedSSO);

const showOnboarding = !hasAnyAccess || showBeta;
if (showOnboarding) {
if (usedSSO && !showBeta) {
return <SsoUserMessage />;
}
Comment on lines +30 to +32
Copy link
Member Author

@travjenkins travjenkins Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing folks to still force show the sign up flow.


return (
<OnboardGuard grantsMutate={mutate} forceDisplay={showOnboarding} />
);
Expand Down
5 changes: 5 additions & 0 deletions src/lang/en-US/LoggingIn.ts
travjenkins marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ export const LoggingIn: Record<string, string> = {

'tenant.error.failedToFetch.message': `There was an issue while checking if you have access to a tenant.`,

'tenant.usedSso.title': `Ask admin for invite link`,
'tenant.usedSso.message': `Your account was created successfuly and can be added to your organization's tenant.`,
'tenant.usedSso.instructions1': `Your admin user needs to create an invite link and share with you.`,
'tenant.usedSso.instructions2': `When you access this link you will be added to the tenant.`,

// Registration
'register.heading': `We're currently accepting Beta partners.`,
'register.main.message': `Please enter your information and our team will approve your account.`,
Expand Down
Loading