File size: 1,362 Bytes
d3f54c7
d25f219
c7a760b
d25f219
 
 
 
e71b7c1
d25f219
 
 
 
 
c7a760b
f082504
d25f219
 
 
 
 
c7b911d
d25f219
aaf87e0
d25f219
3d21152
d25f219
 
 
 
c7a760b
d25f219
33fa8fe
d25f219
 
 
 
86a0d10
d25f219
a107c6a
d25f219
 
 
33fa8fe
d25f219
 
 
 
 
33fa8fe
8875046
d375c20
33fa8fe
d25f219
33fa8fe
d25f219
33fa8fe
 
 
 
 
 
d3f54c7
d25f219
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import streamlit as st
from streamlit_option_menu import option_menu

def loadfile():
    with open("data.json") as f:
        data = load.json(f)
        return data

def savefile(newuser):
    data = loadfile()
    data['users'].append(newuser)
    with open("data.json", "w") as f:
        json.dump(data, f, indent=4)

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:
                savefile(newuser)
        
            st.write("You are Logged in Sucessfully")
    else:
     st.error("Try again")

    

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()