Fix sign in redirect

This commit is contained in:
Joey Yakimowich-Payne 2026-01-16 10:39:58 -07:00
commit c550534d6c
No known key found for this signature in database
GPG key ID: 6BFE655FA5ABD1E1
4 changed files with 20 additions and 4 deletions

View file

@ -90,7 +90,10 @@ export const AuthButton: React.FC<AuthButtonProps> = ({ onAccountSettingsClick }
return ( return (
<button <button
onClick={() => auth.signinRedirect()} onClick={() => {
sessionStorage.setItem('kaboot_auth_return_url', window.location.pathname + window.location.search);
auth.signinRedirect();
}}
className="flex items-center gap-2 bg-white/10 px-4 py-2 rounded-xl hover:bg-white/20 transition font-bold" className="flex items-center gap-2 bg-white/10 px-4 py-2 rounded-xl hover:bg-white/20 transition font-bold"
> >
<LogIn size={20} /> <LogIn size={20} />

View file

@ -348,7 +348,10 @@ export const Landing: React.FC<LandingProps> = ({ onGenerate, onCreateManual, on
<Lock size={32} className="mx-auto mb-3 text-gray-400" /> <Lock size={32} className="mx-auto mb-3 text-gray-400" />
<p className="text-gray-500 font-bold mb-4">Sign in to host quizzes</p> <p className="text-gray-500 font-bold mb-4">Sign in to host quizzes</p>
<button <button
onClick={() => auth.signinRedirect()} onClick={() => {
sessionStorage.setItem('kaboot_auth_return_url', window.location.pathname + window.location.search);
auth.signinRedirect();
}}
className="bg-theme-primary text-white py-3 px-6 rounded-2xl font-black hover:opacity-90 transition-all" className="bg-theme-primary text-white py-3 px-6 rounded-2xl font-black hover:opacity-90 transition-all"
> >
Sign In Sign In

View file

@ -190,7 +190,10 @@ export const SharedQuizView: React.FC<SharedQuizViewProps> = ({ onHostQuiz, shar
</button> </button>
) : ( ) : (
<button <button
onClick={() => auth.signinRedirect()} onClick={() => {
sessionStorage.setItem('kaboot_auth_return_url', window.location.pathname);
auth.signinRedirect();
}}
className="w-full bg-gray-100 text-gray-600 py-3 rounded-2xl text-lg font-black hover:bg-gray-200 shadow-[0_4px_0_#d1d5db] active:shadow-none active:translate-y-[4px] transition-all flex items-center justify-center gap-2" className="w-full bg-gray-100 text-gray-600 py-3 rounded-2xl text-lg font-black hover:bg-gray-200 shadow-[0_4px_0_#d1d5db] active:shadow-none active:translate-y-[4px] transition-all flex items-center justify-center gap-2"
> >
<LogIn size={20} /> Sign in to Save <LogIn size={20} /> Sign in to Save

View file

@ -34,7 +34,14 @@ if (!rootElement) {
const shouldSkipSigninCallback = !window.location.pathname.startsWith('/callback'); const shouldSkipSigninCallback = !window.location.pathname.startsWith('/callback');
const onSigninCallback = () => { const onSigninCallback = () => {
const returnUrl = sessionStorage.getItem('kaboot_auth_return_url');
sessionStorage.removeItem('kaboot_auth_return_url');
if (returnUrl && returnUrl !== '/') {
window.location.replace(returnUrl);
} else {
window.history.replaceState({}, document.title, '/'); window.history.replaceState({}, document.title, '/');
}
}; };
const root = ReactDOM.createRoot(rootElement); const root = ReactDOM.createRoot(rootElement);