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
41 changes: 41 additions & 0 deletions src/app/guards/TenantGuard/SsoUserMessage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Stack, Typography } from '@mui/material';
import FullPageWrapper from 'app/FullPageWrapper';
import MessageWithLink from 'components/content/MessageWithLink';
import SingleLineCode from 'components/content/SingleLineCode';
import AlertBox from 'components/shared/AlertBox';
import { useIntl } from 'react-intl';

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

return (
<FullPageWrapper fullWidth>
<AlertBox
short
severity="info"
title={intl.formatMessage({ id: 'tenant.usedSso.title' })}
>
<Stack spacing={2}>
<Typography>
{intl.formatMessage({ id: 'tenant.usedSso.message' })}
</Typography>

<Stack spacing={1}>
<MessageWithLink messageID="tenant.usedSso.instructions" />

<SingleLineCode
sx={{
maxWidth: 'fit-content',
}}
value={intl.formatMessage({
id: 'tenant.usedSso.instructions.fullPath',
})}
/>
</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
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { authenticatedRoutes } from 'app/routes';
import { CommonMessages } from './CommonMessages';
import { CTAs } from './CTAs';
import { Navigation } from './Navigation';

export const LoggingIn: Record<string, string> = {
export const Authentication: Record<string, string> = {
'login.documentAcknowledgement': `By accessing ${CommonMessages.productName} you agree to our {terms} and {privacy}.`,
'login.jwtExpired': 'Your authorization has expired. Please sign in again.',
'login.userNotFound.onRefresh':
Expand Down Expand Up @@ -110,6 +111,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': `Successfully Authenticated`,
'tenant.usedSso.message': `Your account was created successfully and can be added to your organization's ${CommonMessages.company} tenant.`,
'tenant.usedSso.instructions': `To do so, ask an ${CommonMessages.company} admin at your company to go to the URL below and create an invite link which they can share with you.`,
'tenant.usedSso.instructions.fullPath': `${window.location.origin}${authenticatedRoutes.admin.accessGrants.fullPath}`,

// 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
4 changes: 2 additions & 2 deletions src/lang/en-US/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AdminPage } from './AdminPage';
import { Authentication } from './Authentication';
import { CTAs } from './CTAs';
import { Captures } from './Captures';
import { CommonMessages } from './CommonMessages';
Expand All @@ -7,7 +8,6 @@ import { Errors } from './Errors';
import { EntityTable } from './EntityTable';
import { Fetchers } from './Fetchers';
import { Graphs } from './Graphs';
import { LoggingIn } from './LoggingIn';
import { Materializations } from './Materializations';
import { MonacoEditor } from './MonacoEditor';
import { Transforms } from './Transforms';
Expand Down Expand Up @@ -41,7 +41,7 @@ const enUSMessages: Record<string, string> = {
...Graphs,
...HomePage,
...JsonForms,
...LoggingIn,
...Authentication,
...Materializations,
...MonacoEditor,
...Navigation,
Expand Down
Loading