def btn_login_click(self): password_ = self.ids.txt_pass.text if os.path.exists(LOGIN_DB_PATH): with open(LOGIN_DB_PATH, "r") as login_file: user_name = login_file.readline() self.user_name = user_name has = login_file.readline() if encrypt.validate_paswd(password_, has): App.get_running_app().root.ids.scr.current = "scradd" self.password = encrypt.key_from_paswd(password_) else: self.ids.txt_pass.error() imp_func.show_popup(head='Access Denied', body="Incorrect Password", color=(1, 0, 0, 1), b1="OK", b2="Cancel", bo=self.on_ok, bc=self.on_ok, size=(240, 150)) self.ids.txt_pass.focus = False login_file.close()
def update(self): server_ = self.ids.txt_server1.text _password = self.ids.txt_paswd.text res = database.update_data(self.db, server_, _password, self.password_) if not res: imp_func.show_popup("Error", "Data is not in database", (1, 0, 0, 1))
def show_password(self): _password = database.fetch_data( App.get_running_app().root.ids.scr.get_screen('scradd').db_, App.get_running_app().root.ids.scr.get_screen('scradd').password_, self.get_sname(self.text)) imp_func.show_popup(self.get_sname(self.text), _password, contant.ACTIVE_COLOR, b1="Copy", bc=(lambda: clp.copy(_password)))
def export_db(self): fname = imp_func.save_dlg() if fname: res = database.export_data(self.db_, self.password_, fname) if res == True: imp_func.show_popup("password Maneger", "Successfully Exported", contant.ACTIVE_COLOR) return 1 imp_func.show_popup("Error", "Unable To Export ", (1, 0, 0, 1)) return 0
def show(self): server_ = self.ids.txt_server1.text paswd = self.password_ _password = database.fetch_data(self.db_, paswd, server_) if _password: self.password_d = _password imp_func.show_popup(server_, _password, contant.ACTIVE_COLOR, b1="Copy", bo=self.on_copy) else: imp_func.show_popup("Error", "Server not found", (1, 0, 0, 1))
def add(self): server_ = self.ids.txt_server1.text _password = self.ids.txt_paswd.text if _password == "": imp_func.show_popup("Error", "Password can't be Empty", (1, 0, 0, 1)) return 0 print("finish") self.ids.txt_server1.text = "" self.ids.txt_paswd.text = "" res = database.insert_data(_password, server_, self.db_, self.password_) if res == "found": imp_func.show_popup("Error", "Data Already Exists", (1, 0, 0, 1)) return 1
def remove(self): server2remove = self.ids.txt_server1.text res = database.remove_server(self.db, server2remove) if not res: imp_func.show_popup("Error", "Data Not Found", (1, 0, 0, 1))