def get_credentials(): """ Retrieve stored account credentials. :return: The stored account credentials or an empty dict if none exist. """ email = G.LOCAL_DB.get_value('account_email') password = G.LOCAL_DB.get_value('account_password') verify_credentials(email and password) try: return { 'email': decrypt_credential(email).decode('utf-8'), 'password': decrypt_credential(password).decode('utf-8') } except Exception as exc: # pylint: disable=broad-except raise_from(MissingCredentialsError('Existing credentials could not be decrypted'), exc)
def get_credentials(): """ Retrieve stored account credentials. :return: The stored account credentials or an empty dict if none exist. """ email = G.LOCAL_DB.get_value('account_email') password = G.LOCAL_DB.get_value('account_password') verify_credentials(email and password) try: return { 'email': decrypt_credential(email).decode('utf-8'), 'password': decrypt_credential(password).decode('utf-8') } except Exception: import traceback LOG.error(G.py2_decode(traceback.format_exc(), 'latin-1')) raise MissingCredentialsError( 'Existing credentials could not be decrypted')
def verify_credentials(credential): """Verify credentials for plausibility""" if not credential: raise MissingCredentialsError()