From 16b92796585cc7ef23c31c9b1a2976e8d08c5d93 Mon Sep 17 00:00:00 2001 From: Glenn Gillen Date: Tue, 27 Aug 2024 21:37:55 +1000 Subject: [PATCH 1/2] feat: move verify notice to modal --- src/components/Signup/SignupFlowManager.tsx | 13 +++-- src/components/Signup/VerifyEmail.tsx | 59 +++++++++++++++++++++ 2 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 src/components/Signup/VerifyEmail.tsx 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; From 0435887257e6c9b3d3f75e0d370db707542a8b68 Mon Sep 17 00:00:00 2001 From: Glenn Gillen Date: Mon, 2 Sep 2024 20:58:25 +1000 Subject: [PATCH 2/2] feat: reduce scope to just openid --- src/components/Auth/index.tsx | 4 ++++ 1 file changed, 4 insertions(+) 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',