MANIKANDAN A
commited on
Commit
·
c3efa14
1
Parent(s):
fec7940
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ heading_style = "font-size: 24px; font-weight: bold; text-align: center;"
|
|
22 |
input_style = "margin-top: 10px; padding: 5px; width: 100%;"
|
23 |
|
24 |
# Function to create the SQLite table if it doesn't exist
|
25 |
-
@st.
|
26 |
def create_table():
|
27 |
with sqlite3.connect("login.db") as conn:
|
28 |
cursor = conn.cursor()
|
@@ -38,13 +38,13 @@ def create_table():
|
|
38 |
|
39 |
# Function for signup section
|
40 |
def signup_section():
|
41 |
-
|
42 |
st.markdown(f"<p style='{heading_style}'>Signup</p>", unsafe_allow_html=True)
|
43 |
st.markdown("<p style='text-align: center;'>Please fill in the details to sign up:</p>", unsafe_allow_html=True)
|
44 |
|
45 |
-
new_username = st.text_input("New Username", key="new_username",
|
46 |
-
new_password = st.text_input("New Password", type="password", key="new_password",
|
47 |
-
new_email = st.text_input("Email", key="new_email",
|
48 |
|
49 |
if st.button("Signup", style="margin-top: 10px;"):
|
50 |
if not new_username or not new_password or not new_email:
|
@@ -65,12 +65,12 @@ def signup_section():
|
|
65 |
|
66 |
# Function for login section
|
67 |
def login_section():
|
68 |
-
|
69 |
st.markdown(f"<p style='{heading_style}'>Login</p>", unsafe_allow_html=True)
|
70 |
st.markdown("<p style='text-align: center;'>Please enter your login details:</p>", unsafe_allow_html=True)
|
71 |
|
72 |
-
username = st.text_input("Username", key="login_username",
|
73 |
-
password = st.text_input("Password", type="password", key="login_password",
|
74 |
|
75 |
if st.button("Login", style="margin-top: 10px;"):
|
76 |
if not username or not password:
|
|
|
22 |
input_style = "margin-top: 10px; padding: 5px; width: 100%;"
|
23 |
|
24 |
# Function to create the SQLite table if it doesn't exist
|
25 |
+
@st.cache_resource
|
26 |
def create_table():
|
27 |
with sqlite3.connect("login.db") as conn:
|
28 |
cursor = conn.cursor()
|
|
|
38 |
|
39 |
# Function for signup section
|
40 |
def signup_section():
|
41 |
+
|
42 |
st.markdown(f"<p style='{heading_style}'>Signup</p>", unsafe_allow_html=True)
|
43 |
st.markdown("<p style='text-align: center;'>Please fill in the details to sign up:</p>", unsafe_allow_html=True)
|
44 |
|
45 |
+
new_username = st.text_input("New Username", key="new_username", help="Choose a unique username")
|
46 |
+
new_password = st.text_input("New Password", type="password", key="new_password", help="Password should be at least 8 characters long")
|
47 |
+
new_email = st.text_input("Email", key="new_email", help="Enter a valid email address")
|
48 |
|
49 |
if st.button("Signup", style="margin-top: 10px;"):
|
50 |
if not new_username or not new_password or not new_email:
|
|
|
65 |
|
66 |
# Function for login section
|
67 |
def login_section():
|
68 |
+
|
69 |
st.markdown(f"<p style='{heading_style}'>Login</p>", unsafe_allow_html=True)
|
70 |
st.markdown("<p style='text-align: center;'>Please enter your login details:</p>", unsafe_allow_html=True)
|
71 |
|
72 |
+
username = st.text_input("Username", key="login_username", help="Enter your username")
|
73 |
+
password = st.text_input("Password", type="password", key="login_password",help="Enter your password")
|
74 |
|
75 |
if st.button("Login", style="margin-top: 10px;"):
|
76 |
if not username or not password:
|