def resetKeyring(self): if not xbmcutil.yesNoDialog(T(32035),T(32036),T(32037),T(32035)): return internalGetpass.clearKeyMemory() keyring = passwordStorage.getKeyring() kr = keyring.get_keyring() kr.reset() passwordStorage.saveKeyToDisk() self.updateDisplay()
def resetKeyring(self): if not xbmcutil.yesNoDialog(T(32035), T(32036), T(32037), T(32035)): return internalGetpass.clearKeyMemory() keyring = passwordStorage.getKeyring() kr = keyring.get_keyring() kr.reset() passwordStorage.saveKeyToDisk() self.updateDisplay()
def retrieve(username, ask_on_fail=True, ask_msg=None): """ Get the password associated with the provided username If no password is stored or the is an error and ask_on_fail is true (default) then shows a dialog asking for the password If no password is obtained, returns None """ keyring = getKeyring() password = None try: password = keyring.get_password(SERVICE_NAME, username) except errors.AbortException: LOG('retreive() 1 - User aborted keyring unlock!!!') xbmcutil.okDialog( 'Failed', 'Keyring remains locked.', '', 'Could not get the Facebook password from the keyring.') except errors.IncorrectKeyringKeyException: LOG('retreive() 1 - User entered incorrect keyring password!!!') xbmcutil.okDialog( 'Failed', 'Incorrect keyring password.', '', 'Could not get the Facebook password from the keyring.') except ValueError: try: internalGetpass.clearKeyMemory() password = keyring.get_password(SERVICE_NAME, username) except errors.AbortException: LOG('retreive() 2 - User aborted keyring unlock!!!') xbmcutil.okDialog( 'Failed', 'Keyring remains locked.', '', 'Could not get the Facebook password from the keyring.') except errors.IncorrectKeyringKeyException: LOG('retreive() 2 - User entered incorrect keyring password!!!') xbmcutil.okDialog( 'Failed', 'Incorrect keyring password.', '', 'Could not get the Facebook password from the keyring.') except: ERROR('Failed to get password from keyring') except: ERROR('Failed to get password from keyring') if password: return password if ask_on_fail: msg = ask_msg or xbmcutil.ADDON.getLocalizedString(32024).format( '[B]{0}[/B]'.format( xbmcaddon.Addon(ADDON_ID).getAddonInfo('name'))) password = xbmcutil.passwordPrompt(msg) if password: return password xbmcutil.okDialog('Failed', 'Failed to retreive password.') return None
def retrieve(username,ask_on_fail=True,ask_msg=None): """ Get the password associated with the provided username If no password is stored or the is an error and ask_on_fail is true (default) then shows a dialog asking for the password If no password is obtained, returns None """ keyring = getKeyring() password = None try: password = keyring.get_password(SERVICE_NAME,username) except errors.AbortException: LOG('retreive() 1 - User aborted keyring unlock!!!') xbmcutil.okDialog('Failed','Keyring remains locked.','','Could not get the Facebook password from the keyring.') except errors.IncorrectKeyringKeyException: LOG('retreive() 1 - User entered incorrect keyring password!!!') xbmcutil.okDialog('Failed','Incorrect keyring password.','','Could not get the Facebook password from the keyring.') except ValueError: try: internalGetpass.clearKeyMemory() password = keyring.get_password(SERVICE_NAME,username) except errors.AbortException: LOG('retreive() 2 - User aborted keyring unlock!!!') xbmcutil.okDialog('Failed','Keyring remains locked.','','Could not get the Facebook password from the keyring.') except errors.IncorrectKeyringKeyException: LOG('retreive() 2 - User entered incorrect keyring password!!!') xbmcutil.okDialog('Failed','Incorrect keyring password.','','Could not get the Facebook password from the keyring.') except: ERROR('Failed to get password from keyring') except: ERROR('Failed to get password from keyring') if password: return password if ask_on_fail: msg = ask_msg or xbmcutil.ADDON.getLocalizedString(32024).format('[B]{0}[/B]'.format(xbmcaddon.Addon(ADDON_ID).getAddonInfo('name'))) password = xbmcutil.passwordPrompt(msg) if password: return password xbmcutil.okDialog('Failed','Failed to retreive password.') return None