DavMelchi commited on
Commit
821982d
·
1 Parent(s): aa56dd5

auth update correct 1

Browse files
Files changed (1) hide show
  1. app.py +3 -21
app.py CHANGED
@@ -1,29 +1,13 @@
1
- import os
2
-
3
  import streamlit as st
4
 
5
 
6
  # Authentication function
7
  def check_password():
8
  """Returns `True` if the user had the correct password."""
9
- # Debug: Print out all available secrets and environment variables
10
- # st.write("Available Secrets:")
11
- # st.write(dict(st.secrets))
12
-
13
- # Debug: Check environment variables
14
- # st.write("Environment Variables:")
15
- # st.write(dict(os.environ))
16
 
17
  def password_entered():
18
  """Checks whether a password entered by the user is correct."""
19
- # Debug: Print out detailed login information
20
- st.write("Login Attempt Details:")
21
- st.write(f"Input Username: {st.session_state.get('username', 'N/A')}")
22
- st.write(f"Input Password: {st.session_state.get('password', 'N/A')}")
23
- st.write(f"Stored Username: {st.secrets.get('username', 'N/A')}")
24
- st.write(f"Stored Password: {st.secrets.get('password', 'N/A')}")
25
-
26
- # Flexible comparison to handle potential type or whitespace issues
27
  if (
28
  str(st.session_state.get("username", "")).strip()
29
  == str(st.secrets.get("username", "")).strip()
@@ -31,12 +15,10 @@ def check_password():
31
  == str(st.secrets.get("password", "")).strip()
32
  ):
33
  st.session_state["password_correct"] = True
34
- print("Login Successful: Credentials Matched")
35
- st.success("Login Successful!")
36
  else:
37
  st.session_state["password_correct"] = False
38
- print("Login Failed: Credentials Do Not Match")
39
- st.error("Login Failed: Check your credentials")
40
 
41
  # Create a visually appealing login form
42
  if (
 
 
 
1
  import streamlit as st
2
 
3
 
4
  # Authentication function
5
  def check_password():
6
  """Returns `True` if the user had the correct password."""
7
+ # st.write(st.secrets)
 
 
 
 
 
 
8
 
9
  def password_entered():
10
  """Checks whether a password entered by the user is correct."""
 
 
 
 
 
 
 
 
11
  if (
12
  str(st.session_state.get("username", "")).strip()
13
  == str(st.secrets.get("username", "")).strip()
 
15
  == str(st.secrets.get("password", "")).strip()
16
  ):
17
  st.session_state["password_correct"] = True
18
+ del st.session_state["password"] # don't store password
19
+ del st.session_state["username"] # don't store username
20
  else:
21
  st.session_state["password_correct"] = False
 
 
22
 
23
  # Create a visually appealing login form
24
  if (