Spaces:
Running
Running
Update index.html
Browse files- index.html +16 -0
index.html
CHANGED
|
@@ -438,6 +438,14 @@
|
|
| 438 |
|
| 439 |
// Google login (from modal) con fallback a redirect si el popup falla/bloquea
|
| 440 |
googleLoginButton.addEventListener('click', async () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 441 |
try {
|
| 442 |
const provider = new GoogleAuthProvider();
|
| 443 |
// Sugerir selección de cuenta siempre
|
|
@@ -459,6 +467,10 @@
|
|
| 459 |
const popupIssues = new Set(['auth/popup-blocked', 'auth/popup-closed-by-user', 'auth/cancelled-popup-request']);
|
| 460 |
try {
|
| 461 |
if (popupIssues.has(error?.code)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 462 |
await signInWithRedirect(auth, provider);
|
| 463 |
return;
|
| 464 |
}
|
|
@@ -471,6 +483,10 @@
|
|
| 471 |
loginMessage.innerText = `Error con Google: ${error.message}`;
|
| 472 |
loginMessage.classList.add('text-red-500');
|
| 473 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 474 |
}
|
| 475 |
});
|
| 476 |
|
|
|
|
| 438 |
|
| 439 |
// Google login (from modal) con fallback a redirect si el popup falla/bloquea
|
| 440 |
googleLoginButton.addEventListener('click', async () => {
|
| 441 |
+
// UI: deshabilitar botón para evitar clics múltiples
|
| 442 |
+
googleLoginButton.disabled = true;
|
| 443 |
+
const originalGoogleText = googleLoginButton.innerText;
|
| 444 |
+
googleLoginButton.innerText = 'Abriendo Google...';
|
| 445 |
+
if (loginMessage) {
|
| 446 |
+
loginMessage.innerText = 'Abriendo ventana de Google...';
|
| 447 |
+
loginMessage.classList.remove('text-red-500');
|
| 448 |
+
}
|
| 449 |
try {
|
| 450 |
const provider = new GoogleAuthProvider();
|
| 451 |
// Sugerir selección de cuenta siempre
|
|
|
|
| 467 |
const popupIssues = new Set(['auth/popup-blocked', 'auth/popup-closed-by-user', 'auth/cancelled-popup-request']);
|
| 468 |
try {
|
| 469 |
if (popupIssues.has(error?.code)) {
|
| 470 |
+
if (loginMessage) {
|
| 471 |
+
loginMessage.innerText = 'Redirigiendo a Google...';
|
| 472 |
+
loginMessage.classList.remove('text-red-500');
|
| 473 |
+
}
|
| 474 |
await signInWithRedirect(auth, provider);
|
| 475 |
return;
|
| 476 |
}
|
|
|
|
| 483 |
loginMessage.innerText = `Error con Google: ${error.message}`;
|
| 484 |
loginMessage.classList.add('text-red-500');
|
| 485 |
}
|
| 486 |
+
} finally {
|
| 487 |
+
// Rehabilitar si seguimos en la misma página (si hubo redirect, no se ejecutará esto)
|
| 488 |
+
googleLoginButton.disabled = false;
|
| 489 |
+
googleLoginButton.innerText = originalGoogleText;
|
| 490 |
}
|
| 491 |
});
|
| 492 |
|