Aug-10-2023, 01:22 AM
Hello good,
I have a problem verifying a login. For example, I have 3 records in the database and only 1 user and password are valid, the other two are 2, it always throws me to the "ELIF" that the data is incorrect.
what can be due to that?
I have
user: 1
password: 1
user: 2
password: 2
user: 3
password: 3
Well, of these 3 users, only user 3 fits me well, the other 2 users send me to the "elif" of incorrect data, when everything is fine.
I have a problem verifying a login. For example, I have 3 records in the database and only 1 user and password are valid, the other two are 2, it always throws me to the "ELIF" that the data is incorrect.
what can be due to that?
I have
user: 1
password: 1
user: 2
password: 2
user: 3
password: 3
Well, of these 3 users, only user 3 fits me well, the other 2 users send me to the "elif" of incorrect data, when everything is fine.
self.connection2 = connect_to_database() self.cursor2 = self.connection2.cursor() # Ejemplo: Ejecutar una consulta para obtener datos self.cursor2.execute("SELECT nombre,password FROM usuarios") self.data2 = self.cursor2.fetchall() #messagebox.showwarning("Advertencia", self.data2) # Cerrar el cursor y la conexión for self.fila in self.data2: self.v_email = self.fila[0] self.v_password = self.fila[1] self.cursor2.close() self.connection2.close() if self.entry_email.get() == "" or self.entry_password.get() == "": self.dialogo = tk.Toplevel() self.dialogo.title("ERROR") self.dialogo.geometry("300x50") self.dialogo.resizable(0,0) self.wtotal2 = self.dialogo.winfo_screenwidth() self.htotal2 = self.dialogo.winfo_screenheight() self.wventana2 = 300 self.hventana2 = 100 self.pwidth2 = round(self.wtotal2/2-self.wventana2/2) self.pheight2 = round(self.htotal2/2-self.hventana2/2) self.dialogo.geometry(str(self.wventana2)+"x"+str(self.hventana2)+"+"+str(self.pwidth2)+"+"+str(self.pheight2)) self.etiqueta = tk.Label(self.dialogo, text="Rellena todos los campos.", padx=10, pady=10) self.etiqueta.pack() self.image_boton_vale = Image.open("src/boton_vale.png") self.photo_boton_vale = ImageTk.PhotoImage(self.image_boton_vale) self.boton_vale = tk.Button(self.dialogo, image=self.photo_boton_vale, command=self.cerrar_dialogo_vale) self.boton_vale.pack(pady=5) self.boton_vale.place(x=86, y=50, width=128, height=31) elif self.entry_email.get() == self.v_email and self.entry_password.get() == self.v_password: self.app.root.destroy() self.ventana_menu = Menus(self) else: self.app.root.destroy() messagebox.showwarning("Advertencia", "Los datos introducidos son incorrectos.")What could cause this error?