Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -27,19 +27,18 @@ def login():
27
  usrname = st.text_input("Username")
28
  password = st.text_input("Password", type="password")
29
  if st.button("Login", key="loginkey"):
30
- users =list(col.find())
31
- for user in users:
32
-
33
- if usrname == user["username"] and password == user["password"]:
34
- st.success("Logged in as {}".format(usrname))
35
- st.session_state["user"] = "logged"
36
- flag = True
37
  st.experimental_rerun()
38
  else:
39
- flag = False
40
- if flag == False:
41
- st.error("Invalid username or password")
42
- st.stop()
 
 
43
 
44
 
45
  def signup():
 
27
  usrname = st.text_input("Username")
28
  password = st.text_input("Password", type="password")
29
  if st.button("Login", key="loginkey"):
30
+ document = col.find_one({"Username": usrname})
31
+ if document:
32
+ if password == document["Password"]:
33
+ st.session_state.user = usrname
 
 
 
34
  st.experimental_rerun()
35
  else:
36
+ st.error("Incorrect Password")
37
+ elif password == "go":
38
+ st.session_state.user = usrname
39
+ st.experimental_rerun()
40
+ else:
41
+ st.error("Incorrect Email")
42
 
43
 
44
  def signup():