def get_info():
    """
    :return: The saved information from Windows Credential
    """
    keyring.set_keyring(Windows.WinVaultKeyring())

    return dict(api_key=Crypt().decrypt_api_key(
        keyring.get_password('freshdesk', 'api_key')),
                agent_id=keyring.get_password('freshdesk', 'agnet_id'),
                internal_username=keyring.get_password('internal', 'username'),
                internal_cookies=keyring.get_password('internal', 'cookies'),
                agent_name=keyring.get_password('freshdesk', 'agent_name'),
                full_name=keyring.get_password('freshdesk', 'full_agent_name'))
Example #2
0
    def __init__(self, name):
        # type: (str) -> ASettingRegistry
        super(ASettingRegistry, self).__init__()

        if six.PY3:
            import keyring
            # hack for cx_freeze and Windows keyring backend
            if platform.system() == "Windows":
                from keyring.backends import Windows
                keyring.set_keyring(Windows.WinVaultKeyring())

        self._name = name
        self._items = {}
Example #3
0
 def configureKeyring(self):
     """
     Sets the propper keyring backend for the used OS. This isn't
     automatically detected correctly with Nuitka
     """
     if self.osType.usingWindows:
         from keyring.backends import Windows
         keyring.set_keyring(Windows.WinVaultKeyring())
     elif self.osType.usingMac:
         from keyring.backends import OS_X
         keyring.set_keyring(OS_X.Keyring())
     else:
         from keyring.backends import SecretService
         keyring.set_keyring(SecretService.Keyring())
def get_password_from_keyring(section, username):
    """

    Args:
        section (str):
        username (str):

    Returns:
        str
    """
    import keyring
    if sys.platform.startswith('win32'):
        from keyring.backends import Windows
        keyring.set_keyring(Windows.WinVaultKeyring())

    return keyring.get_password(section, username)
Example #5
0
    def __init__(self, name):
        try:
            import keyring

        except Exception:
            raise NotImplementedError(
                "Python module `keyring` is not available.")

        # hack for cx_freeze and Windows keyring backend
        if platform.system().lower() == "windows":
            from keyring.backends import Windows

            keyring.set_keyring(Windows.WinVaultKeyring())

        # Force "OpenPype" prefix
        self._name = "/".join(("OpenPype", name))
Example #6
0
def init_keyring_options():

    print("\n===============")
    print("Credentials Options")
    print("===============\n")

    user_wants_to_change_credentials = False

    if sys.platform == 'win32': # Windows
        from keyring.backends import Windows
        keyring.set_keyring(Windows.WinVaultKeyring())
    else: # Mac
        from keyring.backends import OS_X
        keyring.set_keyring(OS_X.Keyring())

    if keyring.get_password('system', 'username') == None or keyring.get_password('system', 'username') == None:

        print("\nWelcome Stranger! You have not set your username and/or password. Please set them first.")

        username = raw_input("Username: "******"Password: "******"Welcome back, %s. If you want to change or delete your credentials, key in 'Y' without quotes and return to proceed. Else, simply hit return to continue.\nDo you want to change or delete your credentials [Y/N]? " % username)

        if change_credentials.strip() == 'Y' or change_credentials.strip() == 'y':
            keyring.delete_password('system', 'username')
            keyring.delete_password('system', 'password')
            user_wants_to_change_credentials = True
        else if change_credentials.strip() == '':
            user_wants_to_change_credentials = False
        else:
            user_wants_to_change_credentials = False

    return username, password, user_wants_to_change_credentials
Example #7
0
 def __init__(self):
     keyring.set_keyring(Windows.WinVaultKeyring())
     self.crypt = Crypt()
     self.crypt.generate_key()
Example #8
0
from PyQt5 import QtWidgets

from ui_files import Ui_LoginWindow, Ui_ConfigWindow, Ui_ReportWindow, Ui_MainWindow
from models import ModelDataset
from common_functions import import_bulk_update_file


SERVICE = 'key_database_manager'
USERS_STORAGE = 'users_storage'

# setting up keyring (necessary for Windows and macOS)
system = platform.system()
if system == 'Darwin':
    keyring.set_keyring(OS_X.Keyring())
elif system == 'Windows':
    keyring.set_keyring(Windows.WinVaultKeyring())
else:
    pass # rely on autodiscovery for Linux


class LoginWindow(QtWidgets.QDialog, Ui_LoginWindow):

    def __init__(self):
        super(LoginWindow, self).__init__()
        self.setupUi(self)

        self.UiComponents()

    def UiComponents(self):

        # tool button
 def __init__(self):
     keyring.set_keyring(Windows.WinVaultKeyring())