Spaces:
Sleeping
Sleeping
app updated
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import streamlit_authenticator as stauth
|
|
| 5 |
import yaml
|
| 6 |
from yaml.loader import SafeLoader
|
| 7 |
|
| 8 |
-
st.set_page_config(layout="wide")
|
| 9 |
|
| 10 |
with open("config.yaml") as file:
|
| 11 |
config = yaml.load(file, Loader=SafeLoader)
|
|
@@ -27,6 +27,7 @@ with st.sidebar:
|
|
| 27 |
"""
|
| 28 |
)
|
| 29 |
|
|
|
|
| 30 |
with st.expander("Login π", expanded=True):
|
| 31 |
authenticator.login("Login", "main")
|
| 32 |
|
|
@@ -41,6 +42,7 @@ with st.sidebar:
|
|
| 41 |
elif st.session_state["authentication_status"] is None:
|
| 42 |
st.warning("Please enter your username and password")
|
| 43 |
|
|
|
|
| 44 |
with st.expander("Reset password π"):
|
| 45 |
if st.session_state["authentication_status"]:
|
| 46 |
try:
|
|
@@ -51,6 +53,7 @@ with st.sidebar:
|
|
| 51 |
except Exception as e:
|
| 52 |
st.error(e)
|
| 53 |
|
|
|
|
| 54 |
with st.expander("Forgot password π"):
|
| 55 |
try:
|
| 56 |
(
|
|
@@ -66,6 +69,7 @@ with st.sidebar:
|
|
| 66 |
except Exception as e:
|
| 67 |
st.error(e)
|
| 68 |
|
|
|
|
| 69 |
with st.expander("Update user π"):
|
| 70 |
if st.session_state["authentication_status"]:
|
| 71 |
try:
|
|
@@ -76,6 +80,7 @@ with st.sidebar:
|
|
| 76 |
except Exception as e:
|
| 77 |
st.error(e)
|
| 78 |
|
|
|
|
| 79 |
with st.expander("Register user π", expanded=True):
|
| 80 |
try:
|
| 81 |
# payment_key = st.text_input("Enter Payment Key:")
|
|
@@ -88,12 +93,12 @@ with st.sidebar:
|
|
| 88 |
with open("config.yaml", "w") as file:
|
| 89 |
yaml.dump(config, file, default_flow_style=False)
|
| 90 |
|
| 91 |
-
# Credit
|
| 92 |
def current_year():
|
| 93 |
now = datetime.now()
|
| 94 |
return now.year
|
| 95 |
|
| 96 |
-
#
|
| 97 |
current_year = current_year() # This will print the current year
|
| 98 |
st.markdown(
|
| 99 |
f"""
|
|
@@ -111,3 +116,26 @@ if st.session_state["authentication_status"]:
|
|
| 111 |
Welcome!
|
| 112 |
"""
|
| 113 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
import yaml
|
| 6 |
from yaml.loader import SafeLoader
|
| 7 |
|
| 8 |
+
st.set_page_config(page_title="SAAS Template App", page_icon="π§", layout="wide")
|
| 9 |
|
| 10 |
with open("config.yaml") as file:
|
| 11 |
config = yaml.load(file, Loader=SafeLoader)
|
|
|
|
| 27 |
"""
|
| 28 |
)
|
| 29 |
|
| 30 |
+
# Login
|
| 31 |
with st.expander("Login π", expanded=True):
|
| 32 |
authenticator.login("Login", "main")
|
| 33 |
|
|
|
|
| 42 |
elif st.session_state["authentication_status"] is None:
|
| 43 |
st.warning("Please enter your username and password")
|
| 44 |
|
| 45 |
+
# Reset Password
|
| 46 |
with st.expander("Reset password π"):
|
| 47 |
if st.session_state["authentication_status"]:
|
| 48 |
try:
|
|
|
|
| 53 |
except Exception as e:
|
| 54 |
st.error(e)
|
| 55 |
|
| 56 |
+
# Forgot Password
|
| 57 |
with st.expander("Forgot password π"):
|
| 58 |
try:
|
| 59 |
(
|
|
|
|
| 69 |
except Exception as e:
|
| 70 |
st.error(e)
|
| 71 |
|
| 72 |
+
# Update User
|
| 73 |
with st.expander("Update user π"):
|
| 74 |
if st.session_state["authentication_status"]:
|
| 75 |
try:
|
|
|
|
| 80 |
except Exception as e:
|
| 81 |
st.error(e)
|
| 82 |
|
| 83 |
+
# Register User
|
| 84 |
with st.expander("Register user π", expanded=True):
|
| 85 |
try:
|
| 86 |
# payment_key = st.text_input("Enter Payment Key:")
|
|
|
|
| 93 |
with open("config.yaml", "w") as file:
|
| 94 |
yaml.dump(config, file, default_flow_style=False)
|
| 95 |
|
| 96 |
+
# Credit: Time
|
| 97 |
def current_year():
|
| 98 |
now = datetime.now()
|
| 99 |
return now.year
|
| 100 |
|
| 101 |
+
# Credit:
|
| 102 |
current_year = current_year() # This will print the current year
|
| 103 |
st.markdown(
|
| 104 |
f"""
|
|
|
|
| 116 |
Welcome!
|
| 117 |
"""
|
| 118 |
)
|
| 119 |
+
|
| 120 |
+
# Add Main Content Here
|
| 121 |
+
# TODO
|
| 122 |
+
|
| 123 |
+
# Log out
|
| 124 |
+
with st.sidebar:
|
| 125 |
+
with st.expander("Login π", expanded=True):
|
| 126 |
+
authenticator.login("Login", "main")
|
| 127 |
+
|
| 128 |
+
if st.session_state["authentication_status"]:
|
| 129 |
+
authenticator.logout("Logout", "main", key="unique_key")
|
| 130 |
+
st.write(f'Welcome *{st.session_state["name"]}*')
|
| 131 |
+
st.title(
|
| 132 |
+
"You logged in! You can choose a session in the bottom of the sidebar and view content."
|
| 133 |
+
)
|
| 134 |
+
st.markdown(
|
| 135 |
+
"### π±οΈPress "
|
| 136 |
+
R" on your keyboardβ¨οΈ to rerun the app for faster loading π."
|
| 137 |
+
)
|
| 138 |
+
elif st.session_state["authentication_status"] is False:
|
| 139 |
+
st.error("Username/password is incorrect")
|
| 140 |
+
elif st.session_state["authentication_status"] is None:
|
| 141 |
+
st.warning("Please enter your username and password")
|