fix password bug in encryption

This commit is contained in:
Jonathan Wren 2022-09-24 08:47:11 -07:00
parent a76f066a7c
commit 49948c49f7

View file

@ -25,11 +25,7 @@ class BasePasswordEncryption(BaseEncryption):
self._encoding = "utf-8"
# Check keyring first to be ready for decryption
get_keyring_password(self._config["journal"])
# Prompt for password if keyring didn't work
if self.password is None:
self._prompt_password()
self._password = get_keyring_password(self._config["journal"])
@property
def password(self):
@ -45,6 +41,8 @@ class BasePasswordEncryption(BaseEncryption):
return self._encrypt(text)
def decrypt(self, text):
if self.password is None:
self._prompt_password()
while (result := self._decrypt(text)) is None:
self._prompt_password()