Conditions | 5 |
Total Lines | 18 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import getpass |
||
5 | def create_password( |
||
6 | journal_name: str, prompt: str = "Enter password for new journal: " |
||
7 | ) -> str: |
||
8 | while True: |
||
9 | pw = getpass.getpass(prompt) |
||
10 | if not pw: |
||
11 | print("Password can't be an empty string!", file=sys.stderr) |
||
12 | continue |
||
13 | elif pw == getpass.getpass("Enter password again: "): |
||
14 | break |
||
15 | |||
16 | print("Passwords did not match, please try again", file=sys.stderr) |
||
17 | |||
18 | if yesno("Do you want to store the password in your keychain?", default=True): |
||
19 | from .EncryptedJournal import set_keychain |
||
20 | |||
21 | set_keychain(journal_name, pw) |
||
22 | return pw |
||
23 | |||
29 |