Junaidb commited on
Commit
2c2a020
·
verified ·
1 Parent(s): 3a40592

Update login.py

Browse files
Files changed (1) hide show
  1. login.py +15 -29
login.py CHANGED
@@ -1,37 +1,23 @@
1
  import streamlit as st
2
- from databaseengine import DatabaseEngine
3
- import streamlit_authenticator as stauth
4
- import yaml
5
- from yaml.loader import SafeLoader
6
-
7
-
8
-
9
- de=DatabaseEngine()
10
-
11
-
12
- '''
13
- def authenticate_user(username,password):
14
- data={
15
- "username":username,
16
- "password":password
17
- }
18
- auth=de.Login(data)
19
-
20
- #if username in hardcodedlogin_user["usernames"] and password in hardcodedlogin_user["passwords"]:
21
- if auth==True:
22
- return True
23
- else:
24
- return False
25
-
26
- '''
27
-
28
 
29
 
30
 
31
  def LOGIN():
32
  with st.container(border=True):
33
-
34
-
 
 
 
 
 
 
 
 
 
 
 
35
 
36
 
37
-
 
1
  import streamlit as st
2
+ from auth import authenticator
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
 
5
 
6
  def LOGIN():
7
  with st.container(border=True):
8
+ name, auth_status, username = authenticator.login('Login', 'main')
9
+
10
+ if auth_status:
11
+
12
+ return {"loggedin":True,"message":"success"}
13
+
14
+ elif auth_status is False:
15
+
16
+ return {"loggedin":False,"message":"Incorrect credentials"}
17
+
18
+ elif auth_status is None:
19
+ return {"loggedin":False,"message":"Please enter your credentials"}
20
+
21
 
22
 
23
+