(self)
| 45 | return False |
| 46 | |
| 47 | def mainloop(self): |
| 48 | # save data to config |
| 49 | self.config.data["username"] = ( |
| 50 | input(f"username [{self.config.data['username']}]: ") |
| 51 | or self.config.data["username"] |
| 52 | ) |
| 53 | |
| 54 | self.config.data["password"] = getpass.getpass("password: ") |
| 55 | |
| 56 | server_url = ( |
| 57 | input(f"server url [{self.config.data['server_url']}]: ") |
| 58 | or self.config.data["server_url"] |
| 59 | ) |
| 60 | self.config.data["server_url"] = LoginForm.remove_trailing_slash( |
| 61 | server_url.strip() |
| 62 | ) |
| 63 | |
| 64 | self.config.data["cipher_enabled"] = LoginForm.str_to_bool( |
| 65 | input( |
| 66 | f"enabled encryption(recommended) [{LoginForm.bool_to_str(self.config.data['cipher_enabled'])}]: " |
| 67 | ) |
| 68 | or LoginForm.bool_to_str(self.config.data["cipher_enabled"]) |
| 69 | ) |
| 70 | |
| 71 | self.config.data["notification"] = LoginForm.str_to_bool( |
| 72 | input( |
| 73 | f"enabled notification [{LoginForm.bool_to_str(self.config.data['notification'])}]: " |
| 74 | ) |
| 75 | or LoginForm.bool_to_str(self.config.data["notification"]) |
| 76 | ) |
| 77 | |
| 78 | # extra fields |
| 79 | show_extra_fields = input(f"show extra fields [n]: ") or "n" |
| 80 | if not LoginForm.str_to_bool(show_extra_fields): |
| 81 | CustomDialog("Logging in...").mainloop() |
| 82 | return |
| 83 | |
| 84 | # Validate hash_rounds |
| 85 | while True: |
| 86 | hash_rounds = input( |
| 87 | f"hash rounds [{self.config.data['hash_rounds']}]: " |
| 88 | ) or str( |
| 89 | "" |
| 90 | if self.config.data["hash_rounds"] is None |
| 91 | else str(self.config.data["hash_rounds"]) |
| 92 | ) |
| 93 | hash_rounds = hash_rounds.strip() |
| 94 | |
| 95 | if not LoginForm.is_positive_integer(hash_rounds): |
| 96 | CustomDialog( |
| 97 | "Invalid Input\nHash Rounds must be a positive integer.", |
| 98 | msg_type="error", |
| 99 | ) |
| 100 | continue |
| 101 | |
| 102 | self.config.data["hash_rounds"] = int(hash_rounds) |
| 103 | break |
| 104 |
no test coverage detected