mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
added: google oauth for manual registration was made
Signed-off-by: rgrgogu <obsequio.rus@gmail.com>
This commit is contained in:
@@ -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() {
|
||||
<div className="w-full max-w-sm">
|
||||
<OtpVerifyForm
|
||||
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"
|
||||
description={`We sent a 6-digit code to ${email} to finish signing in with Google. It expires in 10 minutes.`}
|
||||
/>
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user