Skip to content

Commit

Permalink
Merge pull request #4 from tonilopezortiz78/main
Browse files Browse the repository at this point in the history
GET_USERNAME METHOD
  • Loading branch information
GauriSP10 committed Oct 15, 2022
2 parents 59c6577 + e51a41f commit 4cda8d2
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
venv
_secret_auth_.json
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

HOW TO INSTALL ALL LIBRARIES:
python3.10 -m venv venv
source venv/bin/activate
python3.10 -m pip install -r requirement.txt

# Streamlit Login/ Sign Up Library [![Downloads](https://static.pepy.tech/personalized-badge/streamlit-login-auth-ui?period=month&units=international_system&left_color=grey&right_color=blue&left_text=downloads)](https://pepy.tech/project/streamlit-login-auth-ui)

The streamlit_login_auth_ui library is meant for streamlit application developers.
Expand Down
19 changes: 19 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import streamlit as st
from streamlit_login_auth_ui.widgets import __login__

__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')

LOGGED_IN= __login__obj.build_login_ui()
username= __login__obj.get_username()

if LOGGED_IN == True:

st.markdown("Your Streamlit Application Begins here!")
st.markdown(st.session_state)
st.write(username)

Binary file modified requirements.txt
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 7 additions & 0 deletions streamlit_login_auth_ui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ def check_auth_json_file_exists(self, auth_filename: str) -> bool:
return True
return False

def get_username(self):
if st.session_state['LOGOUT_BUTTON_HIT'] == False:
fetched_cookies = self.cookies
if '__streamlit_login_signup_ui_username__' in fetched_cookies.keys():
username=fetched_cookies['__streamlit_login_signup_ui_username__']
return username


def login_widget(self) -> None:
"""
Expand Down
9 changes: 0 additions & 9 deletions tests/test_run.py

This file was deleted.

0 comments on commit 4cda8d2

Please sign in to comment.