diff --git a/src/components/Auth/index.tsx b/src/components/Auth/index.tsx index 6d894917..9cd4b559 100644 --- a/src/components/Auth/index.tsx +++ b/src/components/Auth/index.tsx @@ -26,6 +26,7 @@ const Auth0 = new Auth0Client({ domain: publicRuntimeConfig.auth0.issuerBaseHost as string, clientId: publicRuntimeConfig.auth0.clientId as string, authorizationParams: { + scope: 'openid', redirect_uri: `${publicRuntimeConfig.auth0.baseUrl}/auth/callback`, }, }); @@ -38,6 +39,7 @@ const currentUser = async (): Promise => { const userId = window.sessionStorage.getItem('userId') as string | ''; const token = await Auth0.getTokenSilently({ authorizationParams: { + scope: 'openid', audience, }, }); @@ -128,6 +130,7 @@ const Auth: FunctionComponent = ({ const signin = useCallback(async (): Promise => { await Auth0.loginWithRedirect({ authorizationParams: { + scope: 'openid', audience, source: 'ockam-website', }, @@ -137,6 +140,7 @@ const Auth: FunctionComponent = ({ const signup = useCallback(async (): Promise => { await Auth0.loginWithRedirect({ authorizationParams: { + scope: 'openid', audience, screen_hint: 'signup', source: 'ockam-website', diff --git a/src/components/Signup/SignupFlowManager.tsx b/src/components/Signup/SignupFlowManager.tsx index 432ce286..45b14316 100644 --- a/src/components/Signup/SignupFlowManager.tsx +++ b/src/components/Signup/SignupFlowManager.tsx @@ -20,6 +20,7 @@ import MarketplaceSetup from './MarketplaceSetup'; import Notice from './Notice'; import UserDetails from './UserDetails'; import { TIERS } from '../Packaging/tiers'; +import VerifyEmailModal from './VerifyEmail'; type Props = { install: MDXRemoteSerializeResult; @@ -63,6 +64,7 @@ const SignupFlowManager: FC = ({ install, terms }): ReactElement => { const [marketplaceFulfilment, setMarketplacceFulfilment] = useState(false); const [returningDelegate, setReturningDelegate] = useState(false); const [completedDelegate, setCompletedDelegate] = useState(false); + const [verifyEmail, setVerifyEmail] = useState(false); const [transitioning, setTransitioning] = useState(false); // const [nextHidden, setNextHidden] = useState(false); @@ -427,11 +429,13 @@ const SignupFlowManager: FC = ({ install, terms }): ReactElement => { setIsLoaded(true); } } catch (error) { + setVerifyEmail(true); if (error instanceof UnverifiedEmailError) { - setMessage('📨 Check your inbox! Verify your email address and then refresh this page'); - setTimeout(() => { - router.reload(); - }, 5000); + setVerifyEmail(true); + // setMessage('📨 Check your inbox! Verify your email address and then refresh this page'); + // setTimeout(() => { + // router.reload(); + // }, 5000); } else { console.error(error); } @@ -456,6 +460,7 @@ const SignupFlowManager: FC = ({ install, terms }): ReactElement => { return ( {message && } + = ({ open }) => { + const { isOpen, onOpen, onClose } = useDisclosure(); + const router = useRouter(); + + const close = () => { + onClose(); + router.reload(); + }; + + useEffect(() => { + if (open) { + onOpen(); + } + }, [open]); + + return ( + + + + + 📬 + + + Check your inbox! + + + + Before you can proceed we need to confirm your email address. We've already sent you + an email, just click the link in it and then come back here. + + + + + + + + ); +}; + +export default VerifyEmailModal;