Junaidb commited on
Commit
fdc7bcd
·
verified ·
1 Parent(s): e282964

Update ui.py

Browse files
Files changed (1) hide show
  1. ui.py +13 -11
ui.py CHANGED
@@ -1,11 +1,7 @@
1
  import streamlit as st
2
  import requests
3
  import os
4
- from login import LOGIN
5
- from register import REGISTER
6
-
7
-
8
-
9
 
10
 
11
 
@@ -22,12 +18,14 @@ def InitSession():
22
  if "projectname" not in st.session_state:
23
  st.session_state.projectname=""
24
 
25
- if "loggedin" not in st.session_state:
26
- st.session_state.loggedin=False
27
 
28
 
29
  InitSession()
30
 
 
 
31
 
32
  def APP():
33
 
@@ -195,16 +193,20 @@ def APP():
195
  selection_mode="single",
196
  )
197
  if selection==0:
198
- logged_in_object=LOGIN()
199
 
200
- if logged_in_object.get("loggedin")==True :
 
201
 
202
 
203
  SHOWTABS()
204
 
205
- elif logged_in_object.get("loggedin")==False:
206
  st.write("login failed , try again")
207
 
208
  if selection==1:
209
- REGISTER()
 
 
 
 
210
 
 
1
  import streamlit as st
2
  import requests
3
  import os
4
+ from auth import authenticator
 
 
 
 
5
 
6
 
7
 
 
18
  if "projectname" not in st.session_state:
19
  st.session_state.projectname=""
20
 
21
+ #if "loggedin" not in st.session_state:
22
+ # st.session_state.loggedin=False
23
 
24
 
25
  InitSession()
26
 
27
+ name, auth_status, username = authenticator.login('Login', 'main')
28
+
29
 
30
  def APP():
31
 
 
193
  selection_mode="single",
194
  )
195
  if selection==0:
 
196
 
197
+
198
+ if auth_status:
199
 
200
 
201
  SHOWTABS()
202
 
203
+ elif auth_status==False:
204
  st.write("login failed , try again")
205
 
206
  if selection==1:
207
+ try:
208
+ if authenticator.register_user('Register'):
209
+ st.success("User registered successfully!")
210
+ except Exception as e:
211
+ st.error(e)
212