Spaces:
Running
Running
Update register.py
Browse files- register.py +8 -37
register.py
CHANGED
@@ -1,48 +1,19 @@
|
|
1 |
import streamlit as st
|
2 |
-
import
|
3 |
-
|
4 |
|
5 |
|
6 |
tok=os.getenv("TOK")
|
7 |
|
8 |
|
|
|
9 |
def REGISTER():
|
10 |
|
11 |
with st.container(border=True):
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
16 |
|
17 |
-
name=st.text_input("name of the organization ( lab,pharma) ?")
|
18 |
-
operation=st.text_area("primary operation of the organization ? ")
|
19 |
-
username=st.text_input("setup a username")
|
20 |
-
password=st.text_input("setup a password")
|
21 |
-
register_button=st.form_submit_button("Register")
|
22 |
-
|
23 |
-
if register_button:
|
24 |
-
|
25 |
-
response=requests.post("https://thexforce-combat-backend.hf.space/registerorg",json={
|
26 |
-
|
27 |
-
"name":name,
|
28 |
-
"operation":operation,
|
29 |
-
"username":username,
|
30 |
-
"password":password
|
31 |
-
|
32 |
-
|
33 |
-
},headers={
|
34 |
-
|
35 |
-
"Content-Type":"application/json",
|
36 |
-
"Authorization":f"Bearer {tok}"
|
37 |
-
})
|
38 |
-
|
39 |
-
jsonresponse=response.json()
|
40 |
-
if jsonresponse.get("status") == True:
|
41 |
-
st.badge("Success", icon=":material/check:", color="green")
|
42 |
-
#st.session_state.registered=True
|
43 |
-
#st.rerun()
|
44 |
-
|
45 |
-
elif jsonresponse.get("status") == False:
|
46 |
-
|
47 |
-
st.error("ERROR while registering......")
|
48 |
|
|
|
1 |
import streamlit as st
|
2 |
+
from auth import authenticator
|
3 |
+
|
4 |
|
5 |
|
6 |
tok=os.getenv("TOK")
|
7 |
|
8 |
|
9 |
+
|
10 |
def REGISTER():
|
11 |
|
12 |
with st.container(border=True):
|
13 |
+
try:
|
14 |
+
if authenticator.register_user('Register'):
|
15 |
+
st.success("User registered successfully!")
|
16 |
+
except Exception as e:
|
17 |
+
st.error(e)
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|