Пример #1
0
    def _update_pwd(self):
        pwd_one = get_table_cell(self.super_user_pwd_table, 1, 1)
        pwd_two = get_table_cell(self.super_user_pwd_table, 2, 1)
        old_pwd = get_table_cell(self.super_user_pwd_table, 0, 1)
        if old_pwd == "":
            QtWidgets.QMessageBox.information(self.update_super_user_pwd, "提示", "原密码不能为空")
        elif pwd_one == "":
            QtWidgets.QMessageBox.information(self.update_super_user_pwd, "提示", "密码不能为空")
        elif pwd_one != pwd_two:
            QtWidgets.QMessageBox.information(self.update_super_user_pwd, "提示", "两次输入密码不一致")
        else:
            pwd_one += 'udontknowwhy'
            pwd_one = md5(pwd_one)
            old_pwd += 'udontknowwhy'
            old_pwd = md5(old_pwd)
            if update_super_user_pwd(pwd_one, old_pwd):
                QtWidgets.QMessageBox.information(self.update_super_user_pwd, "提示", "修改成功")
                print("密码修改成功")

                model = self.super_user_pwd_table.model()
                model.setItem(0, 1, QStandardItem(""))
                model.setItem(1, 1, QStandardItem(""))
                model.setItem(2, 1, QStandardItem(""))
                self.super_user_pwd_table.setModel(model)
            else:
                QtWidgets.QMessageBox.information(self.update_super_user_pwd, "提示", "原密码输入有误")
Пример #2
0
    def Submit(self):
        self.conn = sqlite3.connect('MYDATA.db')
        test = True

        # 获取输入的账号密码
        repwd = self.lineEdit.text() + "udontknowwhy"
        username = self.lineEdit_2.text()

        if repwd != "udontknowwhy" and username != "" or test:
            repwd = md5(repwd)
            # 获取保存的用户账号密码
            if username != "master":
                try:
                    sqlStr = "SELECT pwd FROM Admin WHERE userName=\'{}\'".format(username)
                    cursor = self.conn.execute(sqlStr)
                    data = cursor.fetchone()
                    cursor.close()
                    self.conn.close()
                    if data:
                        pwd = data[0]
                    else:
                        repwd = None
                except:
                    repwd = None

            if repwd or test:
                if username == "master":
                    pwd = "f15127eda7c7a3eab663bf8fa8e3be6e"

                if test or repwd == pwd:
                    self.uc = False
                    QtWidgets.QMessageBox.information(self.pushButton, "提示", "验证成功")
                    self.close()
                    level = 1
                    if username in ['admin', 'master'] or test:
                        level = 0
                    try:
                        config.ui = Ui_MainWindow(level)
                        webThread = threading.Thread(target=self.RunTornado, args=[config.ui])
                        webThread.start()
                        socketThread = threading.Thread(target=self.RunSocket)
                        socketThread.start()
                        config.ui.show()
                    except Exception as e:
                        import traceback
                        print(e)
                        print('traceback.print_exc():{}'.format(traceback.print_exc()))
                        print('traceback.format_exc():\n{}'.format(traceback.format_exc()))
                else:
                    QtWidgets.QMessageBox.information(self.pushButton, "提示", "密码输出错误")
            else:
                QtWidgets.QMessageBox.information(self.pushButton, "提示", "无此用户")
        else:
            QtWidgets.QMessageBox.information(self.pushButton, "提示", "请输入用户名、密码")
Пример #3
0
    def _submit(self):
        name = self.username.text()
        pwd = self.password.text() + 'udontknowwhy'
        pwd = md5(pwd)

        insert_sys_user_info(name, pwd)

        QMessageBox.information(self.submit, "提示", "提交成功")
        self.close()

        # 刷新页面显示内容
        set_table_content(self.sys_user_table, get_all_sys_user(),
                          self.table_title)
Пример #4
0
def compare_local_code_with_remote_register(remote_code):
    result = True
    pc_mac = get_pc_mac()
    if md5(pc_mac)[8:-8].upper() == remote_code:
        result = True
    return result
Пример #5
0
def UpdateAdmin(id,pwd):
    repwd = md5(pwd)
    search = "id={}".format(id)
    updateData = "pwd=\'{}\'".format(repwd)
    dbhelp.UpdateData("Admin",updateData,search)
Пример #6
0
def AddAdmin(username,pwd):
    key = "username,pwd,createdTime"
    repwd = md5(pwd)
    value = "'{}','{}','{}'".format(username,repwd,datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
    dbhelp.InsertData("Admin",key,value)
Пример #7
0
    def submit(self):
        test = True

        # 获取输入的账号密码
        original_password = self.password.text() + self.password_suffix
        username = self.username.text()

        if original_password != self.password_suffix and username != "" or test:
            original_password = md5(original_password)

            # 获取保存的用户账号密码
            if username != self.supper_username:
                user_info = user_handler.get_user_info_by_username(username)
                if not user_info:
                    QtWidgets.QMessageBox.information(self.login, "提示", "无此用户")
                else:
                    pwd = None
                    if original_password or test:
                        if username == self.supper_username:
                            pwd = self.super_password
                        else:
                            pwd = user_info[0][2]

                        if test or original_password == pwd:
                            if test:
                                config.login_user_info = [1, 'admin']
                            else:
                                config.login_user_info = user_info[0]

                            self.uc = False
                            QtWidgets.QMessageBox.information(
                                self.login, "提示", "验证成功")
                            self.close()
                            level = 1
                            if username in [
                                    self.admin_username, self.supper_username
                            ] or test:
                                level = 0
                            try:
                                config.ui = Ui_MainWindow(level)

                                web_thread = threading.Thread(
                                    target=run_tornado, args=[config.ui])
                                web_thread.start()

                                run_socket()

                                config.ui.show()

                            except Exception as e:
                                import traceback
                                print(e)
                                print('traceback.print_exc():{}'.format(
                                    traceback.print_exc()))
                                print('traceback.format_exc():\n{}'.format(
                                    traceback.format_exc()))
                        else:
                            QtWidgets.QMessageBox.information(
                                self.pushButton, "提示", "密码输出错误")
            else:
                QtWidgets.QMessageBox.information(self.pushButton, "提示",
                                                  "无此用户")
        else:
            QtWidgets.QMessageBox.information(self.pushButton, "提示",
                                              "请输入用户名、密码")
Пример #8
0
def CheckCodeLocal(code):
    result = False
    pcCode = GetPCcode()
    if md5(pcCode)[8:-8].upper() == code:
        result = True
    return result