Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
except CryptoError:
pw = text_input("Decryption Failure", "Please enter the correct password:", hidden=True)
else:
try:
return KVStore(module)
except PersistentDataEncryptedError:
pw = text_input("Encryption Password",
"Please enter your previous encryption password (one last time):",
hidden=True)
while True:
try:
kvs = KVStore(module, pw, unlock=True)
try: # if the above succeeded, try to remove password from keyring
user = getpass.getuser()
keyring.delete_password("instantshare", user)
except:
# keyring backend spec does not include exception type
pass # password did not exist, so we don't need to remove it
return kvs
except CryptoError:
pw = text_input("Decryption Failure", "Please enter the correct password:", hidden=True)
def rm(name):
credentials = get_credentials(name)
keyring.delete_password('aws-keyring-access-key-id', name)
keyring.delete_password('aws-keyring-secret-access-key', name)
if credentials.mfa_serial:
keyring.delete_password('aws-keyring-mfa', name)
print("Credentials for account name '{}' deleted.".format(name))
def clear_config(self):
keyring.delete_password(const.NAMESPACE, 'rackspace_username')
keyring.delete_password(const.NAMESPACE, 'rackspace_api_key')
keyring.delete_password(const.NAMESPACE, 'aws_profile_name')
Removes a username/password from KeyRing
and replaces with a new one if desired.
:param service_name: (str)
The service name to remove.
:param username: (str)
The username to remove the password for.
:param new_secret_items: (list, default None)
The new secret item(s) to assign to the username if desired.
:return: (None)
"""
try:
keyring.delete_password(service_name, username)
except keyring.errors.PasswordDeleteError:
pass
if new_secret_items:
new_pass = self._join_password_items(new_secret_items)
keyring.set_password(service_name, username, new_pass)
def delete_pass(github_username):
appname = "protomate"
username = github_username
keyring.delete_password(appname, username)
def delete(key):
"""Delete the key."""
try:
keyring.delete_password(__name__, key)
except Exception as e:
click.echo((Exception, e))
def delete_password_in_keyring(username):
return keyring.delete_password(
KEYRING_SYSTEM,
username,
)
response=d.run()
dfd = d.get_form_data()
d.destroy()
if response == 1:
password = dfd['password']
remember = dfd['remember']
if remember and password != '':
try:
keyring.set_password(KEYRING_SERVICE_NAME, user, password)
except:
#TODO: If system keyring daemon is not running, an error will be raised -- need to be more informative to the user
pass
elif not remember:
try:
# only available in newer versions
keyring.delete_password(KEYRING_SERVICE_NAME, user)
except:
# maybe give a warning?
pass
return password
return None
def clear_passwords(config, args, *extra, **kwargs):
keyring.delete_password(
'taskwarrior_inthe.am',
'api_key',
)
keyring.delete_password(
'taskwarrior_inthe.am',
'api_v2_key',
)