Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multipage APP #13

Open
wangjiawen2013 opened this issue Jan 11, 2023 · 7 comments
Open

multipage APP #13

wangjiawen2013 opened this issue Jan 11, 2023 · 7 comments

Comments

@wangjiawen2013
Copy link

Hi,
Streamlit now support multipage app (https://docs.streamlit.io/library/get-started/multipage-apps). Then how to use streamlit_login_auth_ui where there are many pages ?

@fsmosca
Copy link

fsmosca commented Jan 16, 2023

Here is a sample scheme. Users can only log in/out from the main page. Store a login session state variable so that other pages has login info. They can use it to open its contents.

Sample layout.

main.py

import streamlit as st
from streamlit_login_auth_ui.widgets import __login__


if 'login' not in st.session_state:
    st.session_state.login = False


__login__obj = __login__(auth_token="courier_auth_token",
                    company_name="Shims",
                    width=200, height=250,
                    logout_button_name='Logout', hide_menu_bool=False,
                    hide_footer_bool=False,
                    lottie_url='https://assets2.lottiefiles.com/packages/lf20_jcikwtux.json')

st.session_state.login = __login__obj.build_login_ui()

if st.session_state.login:
   st.markdown("Welcome to Main page!")

pages/chatgpt.py

import streamlit as st


if 'login' not in st.session_state:
    st.session_state.login = False

if st.session_state.login:
    st.write('Welcome to ChatGPT')
else:
    st.write('Please login in the main page to see its contents.')

@wangjiawen2013
Copy link
Author

Thanks, it really helps a lot.
In some cases, I want to forbid to create new accounts, could you add that function/option ?

@fsmosca
Copy link

fsmosca commented Jan 30, 2023

I already have that feature on my branch. This is now offered as pull request.

@wangjiawen2013
Copy link
Author

wangjiawen2013 commented Feb 2, 2023

Hi,
In the following code:
__login__obj = login(auth_token="courier_auth_token",
company_name="Shims",
width=200, height=250,
logout_button_name='Logout', hide_menu_bool=False,
hide_footer_bool=False,
lottie_url='https://assets2.lottiefiles.com/packages/lf20_jcikwtux.json')
What's the function of [auto_token="courier_auth_token"] ? I changed the vaule to "abcdefg" and nothing happened to my streamlit APP. Besides, after I registratored a new account, I didn't received any email. But I investigated the source code and found that this login_auth_ui indeep has an function to send email. What's wrong ? and I don't understand the relationship between login_auth_ui and courier.

@fsmosca
Copy link

fsmosca commented Feb 3, 2023

From the readme:

auth_token : The unique authorization token received from - https://www.courier.com/email-api/

@wangjiawen2013
Copy link
Author

I am a bit know what it is. Only a few people hear about courier in some countries and no one use it. So it didn't work for us.

@wangjiawen2013
Copy link
Author

Yes, we have never heard about courier before. I registered on https://www.courier.com/email-api/, now I often receive spam emails from courier. Could you tell us how to get authorization token from courier and how to use it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants