def inspectorButtonClicked(self):
username = self.username.get()
password = self.password.get()
if not username:
messagebox.showwarning("Username input is empty", "Please enter username.")
return False
if not password:
messagebox.showwarning("Password input is empty", "Please enter password")
return False
isAnInspectorUsername = self.cursor.execute("SELECT * FROM inspector WHERE username = %s", username)
if not isAnInspectorUsername:
messagebox.showwarning("Username is not an inspector\'s username",
"The username you entered is not an inspector\'s username.")
return False
usernameAndPasswordMatch = self.cursor.execute(
"SELECT * FROM registereduser WHERE (username = %s AND password = %s)", (username, password))
if not usernameAndPasswordMatch:
messagebox.showwarning("Username and password don\'t match", "Sorry, the username and password you entered"
+ " do not match.")
return False
self.loginWindow.withdraw()
inspector = Inspector()
return True
UsersInterface.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录