thursday / app.py
Ankush05's picture
Update app.py
103c644
raw
history blame
1.27 kB
import streamlit as st
import json
from streamlit_option_menu import option_menu
from pymongo import MongoClient
import os
uri = os.environ["MONGO_CONNECTION_STRING"]
def Signup():
username = st.text_input("Username")
password = st.text_input("Password", type="password")
confpass = st.text_input("Confirm Password", type="password")
newuser = {
"username": username,"password": password
}
if st.button("Signup"):
if password == confpass:
col.insert_one({"username": username, "password": password})
st.write("You are Registered Sucessfully")
else:
"Password do not match"
def Login():
username = st.text_input("username")
password = st.text_input("Password")
if st.button("Login"):
if username == "Username" and password == "password":
st.sucess("You are logged in")
else:
st.error("Your username or password do not match")
def main():
with st.sidebar:
selected = option_menu("Menu", ["Login", "Signup"], icons = ["house", "person"])
if selected == "Login":
Login()
elif selected == "Signup":
Signup()
main()