diff --git a/CHANGELOG.md b/CHANGELOG.md index ade34b5d..67a12dd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Changelog ### 1.6 (November 5, 2013) +* __1.6.4__ Fixed a bug that caused creating encrypted journals to fail * __1.6.3__ New, pretty, _useful_ documentation! * __1.6.2__ Starring entries now works for plain-text journals too! * __1.6.1__ Attempts to fix broken config files automatically diff --git a/jrnl/Journal.py b/jrnl/Journal.py index 9f922509..f9122892 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -110,7 +110,7 @@ class Journal(object): journal = None if 'password' in self.config: journal = validate_password(self.config['password']) - if not journal: + if journal is None: journal = util.get_password(keychain=self.name, validator=validate_password) else: with codecs.open(filename, "r", "utf-8") as f: diff --git a/jrnl/__init__.py b/jrnl/__init__.py index 14112f4d..208872cf 100644 --- a/jrnl/__init__.py +++ b/jrnl/__init__.py @@ -7,7 +7,7 @@ jrnl is a simple journal application for your command line. """ __title__ = 'jrnl' -__version__ = '1.6.3' +__version__ = '1.6.4' __author__ = 'Manuel Ebert' __license__ = 'MIT License' __copyright__ = 'Copyright 2013 Manuel Ebert' diff --git a/jrnl/install.py b/jrnl/install.py index 0ff6159b..cd1683d9 100644 --- a/jrnl/install.py +++ b/jrnl/install.py @@ -75,6 +75,8 @@ def install_jrnl(config_path='~/.jrnl_config'): default_config['encrypt'] = True if util.yesno("Do you want to store the password in your keychain?", default=True): util.set_keychain("default", password) + else: + util.set_keychain("default", None) print("Journal will be encrypted.") else: password = None diff --git a/jrnl/util.py b/jrnl/util.py index 7d396f72..2164d5d1 100644 --- a/jrnl/util.py +++ b/jrnl/util.py @@ -29,15 +29,15 @@ def get_password(validator, keychain=None, max_attempts=3): password = pwd_from_keychain or getpass() result = validator(password) # Password is bad: - if not result and pwd_from_keychain: + if result is None and pwd_from_keychain: set_keychain(keychain, None) attempt = 1 - while not result and attempt < max_attempts: + while result is None and attempt < max_attempts: prompt("Wrong password, try again.") password = getpass() result = validator(password) attempt += 1 - if result: + if result is not None: return result else: prompt("Extremely wrong password.")