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 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
def init_keyring(self): return OS_X.Keyring()
import keyring from keyring.backends import OS_X, Windows 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):