@@ -149,9 +149,9 @@ function inicializarFormularioDeAutenticacion() {
149149 const password = document . getElementById ( 'authPassword' ) . value ;
150150
151151 if ( isLogin ) {
152- handleEmailLogin ( email , password ) ;
152+ handleEmailAuth ( email , password , true ) ;
153153 } else {
154- handleEmailRegistration ( email , password ) ;
154+ handleEmailAuth ( email , password , false ) ;
155155 }
156156 } ) ;
157157}
@@ -570,8 +570,6 @@ async function handleAccountDeletion() {
570570 handleAccountDeletion ( ) ;
571571 } ) ;
572572 }
573-
574- mostrarUsuarios ( ) ;
575573// Inicialización
576574document . addEventListener ( 'DOMContentLoaded' , ( ) => {
577575 const authForm = document . getElementById ( 'authForm' ) ;
@@ -601,7 +599,17 @@ document.addEventListener('DOMContentLoaded', () => {
601599
602600// Funciones complementarias
603601function redirectUser ( ) {
604- const allowedPaths = [ "grouvex-studios-recording" , "team" ] ;
605- const targetPath = allowedPaths . find ( path => document . referrer . includes ( path ) ) || "https://grouvex.github.io" ;
606- window . location . href = targetPath ;
602+ const user = auth . currentUser ;
603+ if ( ! user ) return ;
604+
605+ const defaultPath = "https://grouvex.github.io" ;
606+ const lastPath = localStorage . getItem ( 'lastVisitedPath' ) || defaultPath ;
607+
608+ // Verificar acceso antes de redirigir
609+ verificarAcceso ( ) ;
610+
611+ // Redirigir después de 1 segundo para permitir que se complete la autenticación
612+ setTimeout ( ( ) => {
613+ window . location . href = lastPath ;
614+ } , 1000 ) ;
607615}
0 commit comments