diff --git a/src/modules/auth/pages/OAuthCallback.jsx b/src/modules/auth/pages/OAuthCallback.jsx index bb1b6bc..1f71f72 100644 --- a/src/modules/auth/pages/OAuthCallback.jsx +++ b/src/modules/auth/pages/OAuthCallback.jsx @@ -73,7 +73,10 @@ export default function OAuthCallback() { // already set by the backend; restoreSession() just picks it up. const { success, user } = await restoreSession() if (cancelled) return - navigate(success ? getRoleHomePath(user) : '/login', { replace: true }) + navigate(success ? getRoleHomePath(user) : '/login', { + replace: true, + state: success && pending.justLinkedGoogle ? { justLinkedGoogle: true } : undefined, + }) })() return () => { cancelled = true } @@ -89,7 +92,10 @@ export default function OAuthCallback() {
navigate(getRoleHomePath(user), { replace: true })} + onSuccess={(user) => navigate(getRoleHomePath(user), { + replace: true, + state: result?.justLinkedGoogle ? { justLinkedGoogle: true } : undefined, + })} title="Verify your sign-in" description={`We sent a 6-digit code to ${email} to finish signing in with Google. It expires in 10 minutes.`} /> diff --git a/src/modules/client/pages/Dashboard.jsx b/src/modules/client/pages/Dashboard.jsx index 978c3d3..a8c6c52 100644 --- a/src/modules/client/pages/Dashboard.jsx +++ b/src/modules/client/pages/Dashboard.jsx @@ -240,6 +240,17 @@ const Client = () => { window.history.replaceState({}, ''); }, []); + // Show a one-time notice the first time a manually-registered account + // gets folded into a Google sign-in with the same email. + useEffect(() => { + if (!navState?.justLinkedGoogle) return; + toast('Your Google account is now affiliated with this account.', { + description: 'You can sign in with Google going forward.', + duration: 6000, + }); + window.history.replaceState({}, ''); + }, []); + useEffect(() => { getCourses(); getUnits();