This reverts commit 9612a4928d.
(Causes a google auth sign-up issue)
This commit is contained in:
@ -5,7 +5,7 @@ import { Avatar } from 'twenty-ui/display';
|
|||||||
import { UndecoratedLink } from 'twenty-ui/navigation';
|
import { UndecoratedLink } from 'twenty-ui/navigation';
|
||||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||||
import { useRedirectToDefaultDomain } from '~/modules/domain-manager/hooks/useRedirectToDefaultDomain';
|
import { useRedirectToDefaultDomain } from '~/modules/domain-manager/hooks/useRedirectToDefaultDomain';
|
||||||
import { useReadDefaultDomainFromConfiguration } from '~/modules/domain-manager/hooks/useReadDefaultDomainFromConfiguration';
|
import { AppPath } from '~/modules/types/AppPath';
|
||||||
|
|
||||||
type LogoProps = {
|
type LogoProps = {
|
||||||
primaryLogo?: string | null;
|
primaryLogo?: string | null;
|
||||||
@ -59,8 +59,6 @@ export const Logo = ({
|
|||||||
const { redirectToDefaultDomain } = useRedirectToDefaultDomain();
|
const { redirectToDefaultDomain } = useRedirectToDefaultDomain();
|
||||||
const defaultPrimaryLogoUrl = `${window.location.origin}/images/icons/android/android-launchericon-192-192.png`;
|
const defaultPrimaryLogoUrl = `${window.location.origin}/images/icons/android/android-launchericon-192-192.png`;
|
||||||
|
|
||||||
const { defaultUrl } = useReadDefaultDomainFromConfiguration();
|
|
||||||
|
|
||||||
const primaryLogoUrl = getImageAbsoluteURI({
|
const primaryLogoUrl = getImageAbsoluteURI({
|
||||||
imageUrl: primaryLogo ?? defaultPrimaryLogoUrl,
|
imageUrl: primaryLogo ?? defaultPrimaryLogoUrl,
|
||||||
baseUrl: REACT_APP_SERVER_BASE_URL,
|
baseUrl: REACT_APP_SERVER_BASE_URL,
|
||||||
@ -79,7 +77,7 @@ export const Logo = ({
|
|||||||
<StyledContainer onClick={() => onClick?.()}>
|
<StyledContainer onClick={() => onClick?.()}>
|
||||||
{isUsingDefaultLogo ? (
|
{isUsingDefaultLogo ? (
|
||||||
<UndecoratedLink
|
<UndecoratedLink
|
||||||
to={defaultUrl.toString()}
|
to={AppPath.SignInUp}
|
||||||
onClick={redirectToDefaultDomain}
|
onClick={redirectToDefaultDomain}
|
||||||
>
|
>
|
||||||
<StyledPrimaryLogo src={primaryLogoUrl} />
|
<StyledPrimaryLogo src={primaryLogoUrl} />
|
||||||
|
|||||||
@ -3,18 +3,15 @@ import {
|
|||||||
signInUpStepState,
|
signInUpStepState,
|
||||||
} from '@/auth/states/signInUpStepState';
|
} from '@/auth/states/signInUpStepState';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useRecoilValue, useSetRecoilState } from 'recoil';
|
import { useSetRecoilState } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared/utils';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
import { useAuth } from '@/auth/hooks/useAuth';
|
import { useAuth } from '@/auth/hooks/useAuth';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
import { availableWorkspacesState } from '@/auth/states/availableWorkspacesState';
|
|
||||||
import { countAvailableWorkspaces } from '@/auth/utils/availableWorkspacesUtils';
|
|
||||||
|
|
||||||
export const SignInUpGlobalScopeFormEffect = () => {
|
export const SignInUpGlobalScopeFormEffect = () => {
|
||||||
const setSignInUpStep = useSetRecoilState(signInUpStepState);
|
const setSignInUpStep = useSetRecoilState(signInUpStepState);
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const { setAuthTokens, loadCurrentUser } = useAuth();
|
const { setAuthTokens, loadCurrentUser } = useAuth();
|
||||||
const availableWorkspaces = useRecoilValue(availableWorkspacesState);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const tokenPair = searchParams.get('tokenPair');
|
const tokenPair = searchParams.get('tokenPair');
|
||||||
@ -23,9 +20,6 @@ export const SignInUpGlobalScopeFormEffect = () => {
|
|||||||
searchParams.delete('tokenPair');
|
searchParams.delete('tokenPair');
|
||||||
setSearchParams(searchParams);
|
setSearchParams(searchParams);
|
||||||
loadCurrentUser();
|
loadCurrentUser();
|
||||||
}
|
|
||||||
|
|
||||||
if (countAvailableWorkspaces(availableWorkspaces) > 1) {
|
|
||||||
setSignInUpStep(SignInUpStep.WorkspaceSelection);
|
setSignInUpStep(SignInUpStep.WorkspaceSelection);
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
@ -34,7 +28,6 @@ export const SignInUpGlobalScopeFormEffect = () => {
|
|||||||
setSignInUpStep,
|
setSignInUpStep,
|
||||||
loadCurrentUser,
|
loadCurrentUser,
|
||||||
setAuthTokens,
|
setAuthTokens,
|
||||||
availableWorkspaces,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return <></>;
|
return <></>;
|
||||||
|
|||||||
@ -10,11 +10,7 @@ export const useReadDefaultDomainFromConfiguration = () => {
|
|||||||
? `${domainConfiguration.defaultSubdomain}.${domainConfiguration.frontDomain}`
|
? `${domainConfiguration.defaultSubdomain}.${domainConfiguration.frontDomain}`
|
||||||
: domainConfiguration.frontDomain;
|
: domainConfiguration.frontDomain;
|
||||||
|
|
||||||
const defaultUrl = new URL(window.location.href);
|
|
||||||
defaultUrl.hostname = defaultDomain;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
defaultDomain,
|
defaultDomain,
|
||||||
defaultUrl,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
import { useSignInUp } from '@/auth/sign-in-up/hooks/useSignInUp';
|
import { useSignInUp } from '@/auth/sign-in-up/hooks/useSignInUp';
|
||||||
import { useSignInUpForm } from '@/auth/sign-in-up/hooks/useSignInUpForm';
|
import { useSignInUpForm } from '@/auth/sign-in-up/hooks/useSignInUpForm';
|
||||||
import { SignInUpStep } from '@/auth/states/signInUpStepState';
|
import {
|
||||||
|
SignInUpStep,
|
||||||
|
signInUpStepState,
|
||||||
|
} from '@/auth/states/signInUpStepState';
|
||||||
import { workspacePublicDataState } from '@/auth/states/workspacePublicDataState';
|
import { workspacePublicDataState } from '@/auth/states/workspacePublicDataState';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue, useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
import { Logo } from '@/auth/components/Logo';
|
import { Logo } from '@/auth/components/Logo';
|
||||||
import { Title } from '@/auth/components/Title';
|
import { Title } from '@/auth/components/Title';
|
||||||
@ -27,7 +30,6 @@ import { isDefined } from 'twenty-shared/utils';
|
|||||||
import { AnimatedEaseIn } from 'twenty-ui/utilities';
|
import { AnimatedEaseIn } from 'twenty-ui/utilities';
|
||||||
import { PublicWorkspaceDataOutput } from '~/generated/graphql';
|
import { PublicWorkspaceDataOutput } from '~/generated/graphql';
|
||||||
import { SignInUpGlobalScopeFormEffect } from '@/auth/sign-in-up/components/internal/SignInUpGlobalScopeFormEffect';
|
import { SignInUpGlobalScopeFormEffect } from '@/auth/sign-in-up/components/internal/SignInUpGlobalScopeFormEffect';
|
||||||
import { useAuth } from '@/auth/hooks/useAuth';
|
|
||||||
|
|
||||||
const StandardContent = ({
|
const StandardContent = ({
|
||||||
workspacePublicData,
|
workspacePublicData,
|
||||||
@ -60,6 +62,7 @@ const StandardContent = ({
|
|||||||
|
|
||||||
export const SignInUp = () => {
|
export const SignInUp = () => {
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
|
const setSignInUpStep = useSetRecoilState(signInUpStepState);
|
||||||
|
|
||||||
const { form } = useSignInUpForm();
|
const { form } = useSignInUpForm();
|
||||||
const { signInUpStep } = useSignInUp(form);
|
const { signInUpStep } = useSignInUp(form);
|
||||||
@ -70,14 +73,11 @@ export const SignInUp = () => {
|
|||||||
const isMultiWorkspaceEnabled = useRecoilValue(isMultiWorkspaceEnabledState);
|
const isMultiWorkspaceEnabled = useRecoilValue(isMultiWorkspaceEnabledState);
|
||||||
const { workspaceInviteHash, workspace: workspaceFromInviteHash } =
|
const { workspaceInviteHash, workspace: workspaceFromInviteHash } =
|
||||||
useWorkspaceFromInviteHash();
|
useWorkspaceFromInviteHash();
|
||||||
const { signOut } = useAuth();
|
|
||||||
|
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
|
|
||||||
const onClickOnLogo = () => {
|
const onClickOnLogo = () => {
|
||||||
if (!isOnAWorkspace && signInUpStep === SignInUpStep.WorkspaceSelection) {
|
setSignInUpStep(SignInUpStep.Init);
|
||||||
signOut();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const title = useMemo(() => {
|
const title = useMemo(() => {
|
||||||
|
|||||||
@ -399,24 +399,23 @@ export class UserWorkspaceService extends TypeOrmQueryService<UserWorkspace> {
|
|||||||
displayName: workspace.displayName,
|
displayName: workspace.displayName,
|
||||||
workspaceUrls: this.domainManagerService.getWorkspaceUrls(workspace),
|
workspaceUrls: this.domainManagerService.getWorkspaceUrls(workspace),
|
||||||
logo: workspace.logo,
|
logo: workspace.logo,
|
||||||
sso:
|
sso: workspace.workspaceSSOIdentityProviders.reduce(
|
||||||
workspace.workspaceSSOIdentityProviders?.reduce(
|
(acc, identityProvider) =>
|
||||||
(acc, identityProvider) =>
|
acc.concat(
|
||||||
acc.concat(
|
identityProvider.status === 'Inactive'
|
||||||
identityProvider.status === 'Inactive'
|
? []
|
||||||
? []
|
: [
|
||||||
: [
|
{
|
||||||
{
|
id: identityProvider.id,
|
||||||
id: identityProvider.id,
|
name: identityProvider.name,
|
||||||
name: identityProvider.name,
|
issuer: identityProvider.issuer,
|
||||||
issuer: identityProvider.issuer,
|
type: identityProvider.type,
|
||||||
type: identityProvider.type,
|
status: identityProvider.status,
|
||||||
status: identityProvider.status,
|
},
|
||||||
},
|
],
|
||||||
],
|
),
|
||||||
),
|
[] as AvailableWorkspace['sso'],
|
||||||
[] as AvailableWorkspace['sso'],
|
),
|
||||||
) ?? [],
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,12 +439,7 @@ export class UserWorkspaceService extends TypeOrmQueryService<UserWorkspace> {
|
|||||||
({ workspace, appToken }) => {
|
({ workspace, appToken }) => {
|
||||||
return {
|
return {
|
||||||
...this.castWorkspaceToAvailableWorkspace(workspace),
|
...this.castWorkspaceToAvailableWorkspace(workspace),
|
||||||
...(appToken
|
...(appToken ? { personalInviteToken: appToken.value } : {}),
|
||||||
? {
|
|
||||||
personalInviteToken: appToken.value,
|
|
||||||
inviteHash: workspace.inviteHash,
|
|
||||||
}
|
|
||||||
: {}),
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user