Spaces:
Sleeping
Sleeping
Update templates/register.html
Browse files- templates/register.html +15 -1
templates/register.html
CHANGED
|
@@ -85,9 +85,23 @@
|
|
| 85 |
|
| 86 |
if (result.success) {
|
| 87 |
showAlert('Account created successfully! Redirecting...', 'success');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
setTimeout(() => {
|
| 89 |
window.location.href = result.redirect || '/chat';
|
| 90 |
-
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
} else {
|
| 92 |
showAlert(result.message || 'Registration failed', 'danger');
|
| 93 |
}
|
|
|
|
| 85 |
|
| 86 |
if (result.success) {
|
| 87 |
showAlert('Account created successfully! Redirecting...', 'success');
|
| 88 |
+
|
| 89 |
+
// Store user_id in localStorage for backup
|
| 90 |
+
if (result.user_id) {
|
| 91 |
+
localStorage.setItem('user_id', result.user_id);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
// Redirect after a short delay
|
| 95 |
setTimeout(() => {
|
| 96 |
window.location.href = result.redirect || '/chat';
|
| 97 |
+
}, 1000);
|
| 98 |
+
|
| 99 |
+
// Fallback redirect if the first one fails
|
| 100 |
+
setTimeout(() => {
|
| 101 |
+
if (window.location.pathname !== '/chat') {
|
| 102 |
+
window.location.href = '/chat';
|
| 103 |
+
}
|
| 104 |
+
}, 2000);
|
| 105 |
} else {
|
| 106 |
showAlert(result.message || 'Registration failed', 'danger');
|
| 107 |
}
|