Update modules/ui/ui.py
Browse files- modules/ui/ui.py +40 -38
modules/ui/ui.py
CHANGED
|
@@ -350,13 +350,25 @@ def login_form(lang_code, landing_t):
|
|
| 350 |
|
| 351 |
|
| 352 |
#############################################################
|
|
|
|
| 353 |
def register_form(lang_code, landing_t):
|
| 354 |
"""Formulario de registro simplificado - SOLO 3 CAMPOS"""
|
| 355 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
# Solo 3 campos requeridos
|
| 357 |
-
name = st.text_input("Nombre completo *")
|
| 358 |
-
email = st.text_input("Correo institucional *")
|
| 359 |
-
institution = st.text_input("Institución educativa *")
|
| 360 |
|
| 361 |
# Botón simplificado
|
| 362 |
if st.button(landing_t['submit_application'], type="primary"):
|
|
@@ -371,44 +383,34 @@ def register_form(lang_code, landing_t):
|
|
| 371 |
st.error("Por favor usa un correo institucional (no gmail, hotmail, etc.)")
|
| 372 |
return
|
| 373 |
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
reason="Nuevo registro" # Texto fijo
|
| 390 |
-
)
|
| 391 |
|
| 392 |
-
|
|
|
|
|
|
|
| 393 |
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
time.sleep(2)
|
| 402 |
-
st.rerun()
|
| 403 |
-
else:
|
| 404 |
-
st.error("❌ Hubo un error al enviar tu solicitud. Por favor, inténtalo de nuevo.")
|
| 405 |
-
logger.error(f"Error al almacenar solicitud para {email}")
|
| 406 |
-
|
| 407 |
-
except Exception as e:
|
| 408 |
-
logger.error(f"Excepción en register_form: {str(e)}", exc_info=True)
|
| 409 |
-
st.error(f"❌ Error técnico: {str(e)}")
|
| 410 |
|
| 411 |
-
#############################################################
|
| 412 |
|
| 413 |
#############################################################
|
| 414 |
#############################################################
|
|
|
|
| 350 |
|
| 351 |
|
| 352 |
#############################################################
|
| 353 |
+
|
| 354 |
def register_form(lang_code, landing_t):
|
| 355 |
"""Formulario de registro simplificado - SOLO 3 CAMPOS"""
|
| 356 |
|
| 357 |
+
# Verificar si acabamos de registrar exitosamente
|
| 358 |
+
if 'just_registered' in st.session_state and st.session_state.just_registered:
|
| 359 |
+
st.success("✅ ¡Registro exitoso! Tu solicitud ha sido enviada.")
|
| 360 |
+
st.info("Por favor revisa tu correo para más instrucciones.")
|
| 361 |
+
|
| 362 |
+
# Botón para limpiar y empezar de nuevo
|
| 363 |
+
if st.button("Hacer otro registro"):
|
| 364 |
+
del st.session_state.just_registered
|
| 365 |
+
st.rerun()
|
| 366 |
+
return
|
| 367 |
+
|
| 368 |
# Solo 3 campos requeridos
|
| 369 |
+
name = st.text_input("Nombre completo *", key="reg_name")
|
| 370 |
+
email = st.text_input("Correo institucional *", key="reg_email")
|
| 371 |
+
institution = st.text_input("Institución educativa *", key="reg_institution")
|
| 372 |
|
| 373 |
# Botón simplificado
|
| 374 |
if st.button(landing_t['submit_application'], type="primary"):
|
|
|
|
| 383 |
st.error("Por favor usa un correo institucional (no gmail, hotmail, etc.)")
|
| 384 |
return
|
| 385 |
|
| 386 |
+
# Enviar solicitud
|
| 387 |
+
success = store_application_request(
|
| 388 |
+
name=name,
|
| 389 |
+
lastname="",
|
| 390 |
+
email=email,
|
| 391 |
+
institution=institution,
|
| 392 |
+
current_role="Estudiante",
|
| 393 |
+
desired_role="Estudiante",
|
| 394 |
+
reason="Nuevo registro"
|
| 395 |
+
)
|
| 396 |
+
|
| 397 |
+
if success:
|
| 398 |
+
# Marcar que acabamos de registrar
|
| 399 |
+
st.session_state.just_registered = True
|
| 400 |
+
logger.info(f"Solicitud almacenada exitosamente para {email}")
|
|
|
|
|
|
|
| 401 |
|
| 402 |
+
# Mostrar mensaje y recargar
|
| 403 |
+
st.success("✅ ¡Tu solicitud ha sido enviada! Recibirás un correo con instrucciones.")
|
| 404 |
+
st.balloons()
|
| 405 |
|
| 406 |
+
# Recargar después de 2 segundos
|
| 407 |
+
import time
|
| 408 |
+
time.sleep(2)
|
| 409 |
+
st.rerun()
|
| 410 |
+
else:
|
| 411 |
+
st.error("❌ Hubo un error al enviar tu solicitud. Por favor, inténtalo de nuevo.")
|
| 412 |
+
logger.error(f"Error al almacenar solicitud para {email}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
|
|
|
|
| 414 |
|
| 415 |
#############################################################
|
| 416 |
#############################################################
|