Example #1
0
    def delCount(self):
        fp = open(r"%s"%path1)
        lines = []
        for line in fp: 
            if line.find("=") != -1:
                lines.append(line[0:line.find("=")-1])
        fp.close()
        showstr= "已存在的账户:\n"
        for item in lines:
            #if item != "totalswitch" and item != self.username:
            if item != "totalswitch" :
                showstr = showstr + "    " + str(item) + "\n"
        showstr = showstr + "\n" + "请输入您要删除的账户:"
        text, ok = QInputDialog.getText(None, '重置登录密码', '%s'%showstr)
        if ok and (len(text)!=0):
            if text in lines:
                config = configparser.ConfigParser()
                config.read(r'%s'%path1)
                config.remove_option('information',text)
                config.write(open(r'%s'%path1, "w"))
                
                controller = Controller.CDialogController()
                controller.deleteItem(text)                

                QMessageBox.information(None, "Information", "恭喜您,账户删除成功!")
            else:
                QMessageBox.critical(None, "Critical", "您输入的账户信息不存在!")            
Example #2
0
    def funcMain(self):
        website = self.ui.lineEdit_website0.text()
        if len(website) != 0:
            controller = Controller.CDialogController()
            feedback = controller.searchItemByWebsite(website, self.username)
            if len(feedback) != 0:
                resutl = "搜索结果:\n   用户名:   密码: \n"
                for item in feedback:
                    resutl = resutl + str(item) + "\n"
                QMessageBox.information(None, "Search Result", "%s" % resutl)

            else:
                QMessageBox.critical(None, "Critical", "数据库中无此项数据。")
Example #3
0
    def funcMain(self):
        webpath = self.ui.lineEdit_web.text()
        webusername = self.ui.lineEdit_username.text()
        if len(self.webpassword) == 0:
            self.webpassword = self.ui.lineEdit_password.text()
        passwordkind = self.ui.comboBox.currentIndex()

        if len(webpath) != 0 and len(webusername) != 0 and len(
                self.webpassword) != 0:
            controller = Controller.CDialogController()
            controller.addItem(webpath, webusername, self.webpassword,
                               self.username, self.password, passwordkind,
                               self.passwordCode)
            QMessageBox.information(None, "Information", "恭喜您,信息录入成功!")
Example #4
0
 def funcMain(self):
     webpath = self.ui.lineEdit_webpath.text()
     webusername = self.ui.lineEdit_webusername.text()
     oldwebpassword = self.ui.lineEdit_oldwebpassword.text()
     newpassword = self.ui.lineEdit_newpassword.text()
     newpassword2 = self.ui.lineEdit_newpassword2.text()
     if (len(webpath) != 0) and (len(webusername) != 0) and (
             len(oldwebpassword) != 0) and (len(newpassword) !=
                                            0) and (len(newpassword2) != 0):
         if newpassword == newpassword2:
             controller = Controller.CDialogController()
             feedback = controller.changeWebPassword(
                 self.username, webpath, webusername, oldwebpassword,
                 newpassword)
             QMessageBox.information(None, "Information", "%s" % feedback)
         else:
             QMessageBox.critical(None, "Critical", "两次输入的新密码不一致,请重新操作。")
     else:
         QMessageBox.critical(None, "Critical", "信息不完整,请重新操作。")
Example #5
0
    def modifypassword(self):
        resetFlag = 0
        text, ok = QInputDialog.getText(None, '重置登录密码', '请输入您的新密码?')
        if ok and (len(text)!=0):
            text1, ok1 = QInputDialog.getText(None, '重置登录密码', '请再次输入您的新密码?')
            if ok1 and (len(text1)!=0):   
                if text == text1:
                    QMessageBox.information(None, "Information", "恭喜您,密码重置成功!")
                    self.password = text
                    self.updateUserInfo()
                    resetFlag = 1
                else:
                    QMessageBox.critical(None, "Critical", "两次输入的密码不一致,请重新操作。")
        if resetFlag == 1:
            config = configparser.ConfigParser()
            config.read(r'%s'%path1)
            config.set("information", str(self.username), str(self.password))
            config.write(open(r'%s'%path1, "w"))

            controller = Controller.CDialogController()
            controller.changeLoginPassword(self.username,self.password)