finds and displays password for a given website.
()
| 68 | |
| 69 | # ---------------------------- FIND PASSWORD ------------------------------- # |
| 70 | def find_password(): |
| 71 | """finds and displays password for a given website.""" |
| 72 | website = website_entry.get() |
| 73 | try: |
| 74 | with open("data.json", "r") as data_file: |
| 75 | data = json.load(data_file) |
| 76 | except (FileNotFoundError, json.JSONDecodeError): |
| 77 | messagebox.showerror(title="Error", message="No Data File Found.") |
| 78 | return |
| 79 | |
| 80 | if website in data: |
| 81 | email = data[website]["email"] |
| 82 | password = data[website]["password"] |
| 83 | messagebox.showinfo(title=website, message=f"Email: {email}\nPassword: {password}") |
| 84 | pyperclip.copy(password) |
| 85 | messagebox.showinfo(title="Copied", message="Password for {} copied to clipboard.".format(website)) |
| 86 | else: |
| 87 | messagebox.showerror(title="Error", message=f"No details for {website} exists.") |
| 88 | |
| 89 | # ---------------------------- VIEW ALL PASSWORDS ------------------------------- # |
| 90 | def view_all_passwords(): |