Skip to content

login verification #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/config.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/connection.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/expediente.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/login.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/signup.cpython-39.pyc
Binary file not shown.
31 changes: 18 additions & 13 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
from tkinter import *
from signUp import SignupWindow
from tkinter import messagebox
from signup import SignupWindow
from expediente import ExpedienteWindow
import connection as con


def main():
results = con.connect(r"""select * from prueba;""")
print(results)
principalWindow()



def principalWindow():
win = Tk()
Expand All @@ -19,9 +15,9 @@ def principalWindow():
inputUsername = Entry(win)

etiPassword = Label(win, text="Password")
inputPassword = Entry(win)
inputPassword = Entry(win, show="*")

buttonLogin = Button(win, text="Login", command= lambda: login(inputPassword, inputUsername, win))
buttonLogin = Button(win, text="Login", command= lambda: login(inputUsername, inputPassword, win))
buttonSignup = Button(win, text="Signup", command= lambda: signUp(win))

etiUsername.pack()
Expand All @@ -36,12 +32,21 @@ def principalWindow():

def signUp(win):
SignupWindow(win)

# Login function
def login(inputUsername, inputPassword, win):
username = inputUsername.get()
password = inputPassword.get()
query = f"SELECT COUNT(*) FROM usuarios WHERE username='{username}' AND password='{password}'" # Query
results = con.connect(query)

def login(inputPassword, inputUsername, win):
if (inputPassword.get() == "123" and inputUsername.get() == "123"):
# None type data verification
if results is not None and results[0][0] == 1:
ExpedienteWindow(win)

# Error message if credentials do not match
else:
messagebox.showerror("Error de inicio de sesión", "Usuario o contraseña incorrectos")



if __name__ == '__main__':
main()
main()