Saves password to keyring

Closes #96 and deprecates password field in config
This commit is contained in:
Manuel Ebert 2013-10-17 14:55:59 -07:00
parent b3a51396e7
commit 34b730a5c9
8 changed files with 73 additions and 45 deletions

View file

@ -73,18 +73,19 @@ def install_jrnl(config_path='~/.jrnl_config'):
password = getpass.getpass("Enter password for journal (leave blank for no encryption): ")
if password:
default_config['encrypt'] = True
if util.yesno("Do you want to store the password in your keychain?", default=True):
util.set_keychain("default", password)
print("Journal will be encrypted.")
print("If you want to, you can store your password in .jrnl_config and will never be bothered about it again.")
else:
password = None
print("PyCrypto not found. To encrypt your journal, install the PyCrypto package from http://www.pycrypto.org and run 'jrnl --encrypt'. For now, your journal will be stored in plain text.")
print("PyCrypto not found. To encrypt your journal, install the PyCrypto package from http://www.pycrypto.org or with 'pip install pycrypto' and run 'jrnl --encrypt'. For now, your journal will be stored in plain text.")
# Use highlighting:
if not module_exists("colorama"):
print("colorama not found. To turn on highlighting, install colorama and set highlight to true in your .jrnl_conf.")
default_config['highlight'] = False
open(default_config['journals']['default'], 'a').close() # Touch to make sure it's there
open(default_config['journals']['default'], 'a').close() # Touch to make sure it's there
# Write config to ~/.jrnl_conf
with open(config_path, 'w') as f: