Hi @enryls,
First of all, thanks for using Streamlit! and about your inquire you could solve that in different ways.
1 - Modifying the custom component itself so you can do the checking there.
2 - Solving from the python side using SessionState gist
This is an example if we took the second option:
import streamlit as st
import SessionState
import streamlit.components.v1 as components
_material_login = components.declare_component(
"material_login", url="http://localhost:3001",
)
def rerun():
raise st.script_runner.RerunException(st.script_request_queue.RerunData(None))
def material_login(title, key=None):
return _material_login(title=title, key=key)
session_state = SessionState.get(isLoggedIn=False)
USERNAME = "a@a.com"
PASSWORD = "test"
if session_state.isLoggedIn:
st.balloons()
st.header('Yay ! you are logged in')
else:
logged_in_data = material_login("Insert your account")
if bool(logged_in_data) and logged_in_data['username'] == USERNAME and logged_in_data['password'] == PASSWORD:
session_state.isLoggedIn = True
rerun()