Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def log_in(self):
- user = self.user_entry.get()
- password = self.password_entry.get()
- get_users = ("SELECT * from user WHERE username = %s")
- self.controller.cursor.execute(get_users, (user,))
- uname = self.controller.cursor.fetchone()
- if uname == None:
- tkmb.showerror("Error", "Username not in database.")
- else:
- uname = list(uname)
- if uname[1] != password:
- tkmb.showerror("Error", "Password is incorrect.")
- else:
- self.controller.cnx = mysql.connector.connect(user=user, password=password,
- host='localhost', database='gt_train')
- self.controller.cursor = self.controller.cnx.cursor()
- self.controller.current_user = user
- print self.controller.current_user
- self.controller.show_frame("ChooseFunctionality_Customer")
- # userExists = False;
- # login_success = False;
- # for (uname, pword) in self.controller.cursor:
- # if uname==user:
- # userExists = True;
- # if pword==password:
- # login_success = True;
- # else:
- # tkmb.showerror("Error", "Password is incorrect.")
- # if not userExists:
- # tkmb.showerror("Error", "Username not in database.")
- # if login_success:
- # self.controller.cnx = mysql.connector.connect(user=user, password=password,
- # host='localhost', database='gt_train')
- # self.controller.cursor = self.controller.cnx.cursor()
- # self.controller.current_user = user
- # self.controller.show_frame("ChooseFunctionality_Customer")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement