more system tests as login is borked
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 19s

This commit is contained in:
2025-11-11 01:25:41 -08:00
parent c4b2e905e5
commit 59d57d26a3
4 changed files with 71 additions and 24 deletions

View File

@@ -33,18 +33,35 @@ export const SignUpModal: React.FC<SignUpModalProps> = ({ isOpen, onClose, onSwi
setError(null);
setMessage(null);
try {
const { error } = await supabase.auth.signUp({
email,
password,
options: { emailRedirectTo: window.location.href }
});
if (error) throw error;
setMessage('Check your email for the confirmation link!');
} catch (err: any) {
setError(err.message || 'An unexpected error occurred.');
} finally {
setLoading(false);
// Check if there is a current anonymous session
const { data: { session } } = await supabase.auth.getSession();
if (session && session.user.is_anonymous) {
// If the user is anonymous, upgrade their account instead of creating a new one.
try {
const { error } = await supabase.auth.updateUser({ email, password });
if (error) throw error;
setMessage('Your account has been created! Check your email for a confirmation link.');
} catch (err: any) {
setError(err.message || 'An unexpected error occurred during account upgrade.');
} finally {
setLoading(false);
}
} else {
// Standard sign-up flow for new users.
try {
const { error } = await supabase.auth.signUp({
email,
password,
options: { emailRedirectTo: window.location.href }
});
if (error) throw error;
setMessage('Check your email for the confirmation link!');
} catch (err: any) {
setError(err.message || 'An unexpected error occurred.');
} finally {
setLoading(false);
}
}
};