Fixed error when user fails to enter correct password
Pappy would raise exceptions and continued project in clear-text when the user failed to enter the correct decryption password. Added a boolean status variable to config `crypt_success` that gets set to true when project decrypts correctly, otherwise it is set to false.
This commit is contained in:
parent
6b8861058e
commit
772e7ee507
3 changed files with 8 additions and 3 deletions
|
@ -170,6 +170,7 @@ class PappyConfig(object):
|
||||||
self.crypt_dir = 'crypt'
|
self.crypt_dir = 'crypt'
|
||||||
self.crypt_file = 'project.crypt'
|
self.crypt_file = 'project.crypt'
|
||||||
self.crypt_session = False
|
self.crypt_session = False
|
||||||
|
self.crypt_success = False
|
||||||
self.salt_file = 'project.salt'
|
self.salt_file = 'project.salt'
|
||||||
|
|
||||||
def get_default_config(self):
|
def get_default_config(self):
|
||||||
|
|
|
@ -90,6 +90,7 @@ class Crypto(object):
|
||||||
# Quit pappy if user doesn't retry
|
# Quit pappy if user doesn't retry
|
||||||
# or if all retries exhuasted
|
# or if all retries exhuasted
|
||||||
if not self.confirm_password_retry() or retries <= 0:
|
if not self.confirm_password_retry() or retries <= 0:
|
||||||
|
self.config.crypt_success = False
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
self.password = None
|
self.password = None
|
||||||
|
@ -106,6 +107,7 @@ class Crypto(object):
|
||||||
self.delete_crypt_files()
|
self.delete_crypt_files()
|
||||||
|
|
||||||
os.chdir(self.config.crypt_dir)
|
os.chdir(self.config.crypt_dir)
|
||||||
|
self.config.crypt_success = True
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def confirm_password_retry(self):
|
def confirm_password_retry(self):
|
||||||
|
|
|
@ -72,6 +72,8 @@ class PappySession(object):
|
||||||
|
|
||||||
if self.config.crypt_session:
|
if self.config.crypt_session:
|
||||||
self.decrypt()
|
self.decrypt()
|
||||||
|
|
||||||
|
if self.config.crypt_success:
|
||||||
self.config.load_from_file('./config.json')
|
self.config.load_from_file('./config.json')
|
||||||
self.config.global_load_from_file()
|
self.config.global_load_from_file()
|
||||||
self.delete_data_on_quit = False
|
self.delete_data_on_quit = False
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue