mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
ixed a bug that caused creating encrypted journals to fail
This commit is contained in:
parent
560930a2c2
commit
fb629266e6
5 changed files with 8 additions and 5 deletions
|
@ -3,6 +3,7 @@ Changelog
|
||||||
|
|
||||||
### 1.6 (November 5, 2013)
|
### 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.3__ New, pretty, _useful_ documentation!
|
||||||
* __1.6.2__ Starring entries now works for plain-text journals too!
|
* __1.6.2__ Starring entries now works for plain-text journals too!
|
||||||
* __1.6.1__ Attempts to fix broken config files automatically
|
* __1.6.1__ Attempts to fix broken config files automatically
|
||||||
|
|
|
@ -110,7 +110,7 @@ class Journal(object):
|
||||||
journal = None
|
journal = None
|
||||||
if 'password' in self.config:
|
if 'password' in self.config:
|
||||||
journal = validate_password(self.config['password'])
|
journal = validate_password(self.config['password'])
|
||||||
if not journal:
|
if journal is None:
|
||||||
journal = util.get_password(keychain=self.name, validator=validate_password)
|
journal = util.get_password(keychain=self.name, validator=validate_password)
|
||||||
else:
|
else:
|
||||||
with codecs.open(filename, "r", "utf-8") as f:
|
with codecs.open(filename, "r", "utf-8") as f:
|
||||||
|
|
|
@ -7,7 +7,7 @@ jrnl is a simple journal application for your command line.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__title__ = 'jrnl'
|
__title__ = 'jrnl'
|
||||||
__version__ = '1.6.3'
|
__version__ = '1.6.4'
|
||||||
__author__ = 'Manuel Ebert'
|
__author__ = 'Manuel Ebert'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
__copyright__ = 'Copyright 2013 Manuel Ebert'
|
__copyright__ = 'Copyright 2013 Manuel Ebert'
|
||||||
|
|
|
@ -75,6 +75,8 @@ def install_jrnl(config_path='~/.jrnl_config'):
|
||||||
default_config['encrypt'] = True
|
default_config['encrypt'] = True
|
||||||
if util.yesno("Do you want to store the password in your keychain?", default=True):
|
if util.yesno("Do you want to store the password in your keychain?", default=True):
|
||||||
util.set_keychain("default", password)
|
util.set_keychain("default", password)
|
||||||
|
else:
|
||||||
|
util.set_keychain("default", None)
|
||||||
print("Journal will be encrypted.")
|
print("Journal will be encrypted.")
|
||||||
else:
|
else:
|
||||||
password = None
|
password = None
|
||||||
|
|
|
@ -29,15 +29,15 @@ def get_password(validator, keychain=None, max_attempts=3):
|
||||||
password = pwd_from_keychain or getpass()
|
password = pwd_from_keychain or getpass()
|
||||||
result = validator(password)
|
result = validator(password)
|
||||||
# Password is bad:
|
# Password is bad:
|
||||||
if not result and pwd_from_keychain:
|
if result is None and pwd_from_keychain:
|
||||||
set_keychain(keychain, None)
|
set_keychain(keychain, None)
|
||||||
attempt = 1
|
attempt = 1
|
||||||
while not result and attempt < max_attempts:
|
while result is None and attempt < max_attempts:
|
||||||
prompt("Wrong password, try again.")
|
prompt("Wrong password, try again.")
|
||||||
password = getpass()
|
password = getpass()
|
||||||
result = validator(password)
|
result = validator(password)
|
||||||
attempt += 1
|
attempt += 1
|
||||||
if result:
|
if result is not None:
|
||||||
return result
|
return result
|
||||||
else:
|
else:
|
||||||
prompt("Extremely wrong password.")
|
prompt("Extremely wrong password.")
|
||||||
|
|
Loading…
Add table
Reference in a new issue