Add1E commited on
Commit
a987cc7
Β·
verified Β·
1 Parent(s): 0506f5f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -28
app.py CHANGED
@@ -781,35 +781,33 @@ TRENDS_YESTERDAY_FEED_URL = 'https://trends.google.de/trends/trendingsearches/da
781
 
782
  LINKS_MAX_CHECKED = 3
783
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
784
 
785
- # def check_password():
786
- # """Returns `True` if the user had the correct password."""
787
-
788
- # def password_entered():
789
- # """Checks whether a password entered by the user is correct."""
790
- # if hmac.compare_digest(
791
- # st.session_state["password"], os.environ.get("PASSWORD")
792
- # ):
793
- # st.session_state["password_correct"] = True
794
- # del st.session_state["password"] # Don't store the password.
795
- # else:
796
- # st.session_state["password_correct"] = False
797
-
798
- # # Return True if the password is validated.
799
- # if st.session_state.get("password_correct", False):
800
- # return True
801
-
802
- # # Show input for password.
803
- # st.text_input(
804
- # "Password", type="password", on_change=password_entered, key="password"
805
- # )
806
- # if "password_correct" in st.session_state:
807
- # st.error("πŸ˜• Password incorrect")
808
- # return False
809
-
810
-
811
- # if not check_password():
812
- # st.stop() # Do not continue if check_password is not True.
813
 
814
  col1, col2 = st.columns([2, 1])
815
 
 
781
 
782
  LINKS_MAX_CHECKED = 3
783
 
784
+ def check_password():
785
+ """Returns `True` if the user had the correct password."""
786
+
787
+ def password_entered():
788
+ """Checks whether a password entered by the user is correct."""
789
+ if hmac.compare_digest(st.session_state["password"], os.environ.get("PASSWORD")):
790
+ st.session_state["password_correct"] = True
791
+ del st.session_state["password"] # Don't store the password.
792
+ else:
793
+ st.session_state["password_correct"] = False
794
+
795
+ # Return True if the password is validated.
796
+ if st.session_state.get("password_correct", False):
797
+ return True
798
+
799
+ # Show input for password.
800
+ st.text_input(
801
+ "Password", type="password", on_change=password_entered, key="password"
802
+ )
803
+ if "password_correct" in st.session_state:
804
+ st.error("πŸ˜• Password incorrect")
805
+ return False
806
+
807
+
808
+ if not check_password():
809
+ st.stop() # Do not continue if check_password is not True.
810
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
811
 
812
  col1, col2 = st.columns([2, 1])
813