added: google oauth for manual registration was made

Signed-off-by: rgrgogu <obsequio.rus@gmail.com>
This commit is contained in:
rgrgogu
2026-07-16 02:19:08 +08:00
parent 9b1805da8f
commit 538507fa27
2 changed files with 19 additions and 2 deletions
+8 -2
View File
@@ -73,7 +73,10 @@ export default function OAuthCallback() {
// already set by the backend; restoreSession() just picks it up. // already set by the backend; restoreSession() just picks it up.
const { success, user } = await restoreSession() const { success, user } = await restoreSession()
if (cancelled) return 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 } return () => { cancelled = true }
@@ -89,7 +92,10 @@ export default function OAuthCallback() {
<div className="w-full max-w-sm"> <div className="w-full max-w-sm">
<OtpVerifyForm <OtpVerifyForm
email={email} email={email}
onSuccess={(user) => navigate(getRoleHomePath(user), { replace: true })} onSuccess={(user) => navigate(getRoleHomePath(user), {
replace: true,
state: result?.justLinkedGoogle ? { justLinkedGoogle: true } : undefined,
})}
title="Verify your sign-in" 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.`} description={`We sent a 6-digit code to ${email} to finish signing in with Google. It expires in 10 minutes.`}
/> />
+11
View File
@@ -240,6 +240,17 @@ const Client = () => {
window.history.replaceState({}, ''); 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(() => { useEffect(() => {
getCourses(); getCourses();
getUnits(); getUnits();