Example #1
0
def get_password(user_name):

    passwd = None
    try:
        with LOCK:
            store = Keyring()
            passwd = store.get_password('mail', user_name)
    except Exception:
        logging.exception('failed getting password')

    return passwd
Example #2
0
def get_password(user_name):

    passwd = None
    try:
        with LOCK:
            store = Keyring()
            passwd = store.get_password('mail', user_name)
    except Exception:
        logging.exception('failed getting password')

    return passwd
Example #3
0
def set_password(user_name):
    import getpass
    import keyring

    passwd = None

    pw = getpass.getpass('password for %s: ' % (user_name))
    if pw:
        passwd = pw

    if passwd:
        try:
            with LOCK:
                store = Keyring()
                store.set_password('mail', user_name, passwd)
        except Exception:
            logging.exception('failed setting password')

    return passwd
Example #4
0
def set_password(user_name):
    import getpass
    import keyring

    passwd = None

    pw = getpass.getpass('password for %s: ' % (user_name))
    if pw:
        passwd = pw

    if passwd:
        try:
            with LOCK:
                store = Keyring()
                store.set_password('mail', user_name, passwd)
        except Exception:
            logging.exception('failed setting password')


    return passwd