UsersInterface.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:CS-4400-Georgia-Restaurant-Inspections-report-database 作者: itsxiaoxiaoxiaoxiaoyu 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号