Spaces:
Sleeping
Sleeping
Update templates/register.html
Browse files- templates/register.html +22 -4
templates/register.html
CHANGED
@@ -85,10 +85,28 @@
|
|
85 |
|
86 |
if (result.success) {
|
87 |
showAlert('Account created successfully! Redirecting...', 'success');
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
} else {
|
93 |
showAlert(result.message || 'Registration failed', 'danger');
|
94 |
}
|
|
|
85 |
|
86 |
if (result.success) {
|
87 |
showAlert('Account created successfully! Redirecting...', 'success');
|
88 |
+
|
89 |
+
// Force a new session check
|
90 |
+
const checkSession = async () => {
|
91 |
+
try {
|
92 |
+
const checkResponse = await fetch('/api/check_session', {
|
93 |
+
method: 'GET',
|
94 |
+
credentials: 'same-origin'
|
95 |
+
});
|
96 |
+
if (checkResponse.ok) {
|
97 |
+
window.location.href = result.redirect || '/chat';
|
98 |
+
} else {
|
99 |
+
// If session check fails, try direct redirect
|
100 |
+
window.location.replace(result.redirect || '/chat');
|
101 |
+
}
|
102 |
+
} catch (error) {
|
103 |
+
// If anything fails, force reload to chat page
|
104 |
+
window.location.replace('/chat');
|
105 |
+
}
|
106 |
+
};
|
107 |
+
|
108 |
+
// Try redirect after a short delay
|
109 |
+
setTimeout(checkSession, 500);
|
110 |
} else {
|
111 |
showAlert(result.message || 'Registration failed', 'danger');
|
112 |
}
|