示例#1
0
def set_account_password(email, password):
    attrs = {"email": email}
    if password:
        Secret.password_store_sync(_ACCOUNT_SCHEMA, attrs, Secret.COLLECTION_DEFAULT,
                                    "Pandora Account", password, None)
    else:
        Secret.password_clear_sync(_ACCOUNT_SCHEMA, attrs, None)
def erase():
    attributes = get_attributes()

    if 'password' in attributes:
        del attributes['password']

    Secret.password_clear_sync(GIT_CREDENTIALS_SCHEMA, attributes, None)
示例#3
0
 def set_password_state(self, state: bool):
     schema = self.password_state_schema
     if not state:
         Secret.password_clear_sync(schema, {}, None)
     else:
         Secret.password_store_sync(schema, {}, Secret.COLLECTION_DEFAULT,
                                    "Authenticator state", "true", None)
     self.props.can_be_locked = state and self.has_password()
示例#4
0
def set_account_password(email, password):
    attrs = {"email": email}
    if password:
        Secret.password_store_sync(_ACCOUNT_SCHEMA, attrs,
                                   Secret.COLLECTION_DEFAULT,
                                   "Pandora Account", password, None)
    else:
        Secret.password_clear_sync(_ACCOUNT_SCHEMA, attrs, None)
def erase():
    attributes = get_attributes()

    if 'password' in attributes:
        del attributes['password']

    Secret.password_clear_sync(
            GIT_CREDENTIALS_SCHEMA,
            attributes,
            None
            )
示例#6
0
 def delete_password(self, service, username):
     """Delete the stored password (only the first one)"""
     attributes = {
         "application": self.appid,
         "service": service,
         "username": username,
     }
     try:
         items = Secret.password_search_sync(self.schema, attributes,
                                             Secret.SearchFlags.UNLOCK,
                                             None)
     except GLib.Error as error:
         quark = GLib.quark_try_string('g-io-error-quark')
         if error.matches(quark, Gio.IOErrorEnum.FAILED):
             raise KeyringLocked('Failed to unlock the item!') from error
         raise
     for item in items:
         try:
             removed = Secret.password_clear_sync(self.schema,
                                                  item.get_attributes(),
                                                  None)
         except GLib.Error as error:
             quark = GLib.quark_try_string('secret-error')
             if error.matches(quark, Secret.Error.IS_LOCKED):
                 raise KeyringLocked(
                     'Failed to unlock the item!') from error
             raise
         return removed
     raise PasswordDeleteError("No such password!")
示例#7
0
    def clear(self) -> bool:
        """
           Clear all existing accounts.

           :return bool: Either the token was removed successfully or not
       """
        success = Secret.password_clear_sync(self.schema, {}, None)
        return success
示例#8
0
	def testSyncNotFound(self):
		attributes = { "number": "11", "string": "one", "even": "true" }

		password = Secret.password_lookup_sync(STORE_SCHEMA, attributes, None)
		self.assertEqual(None, password)

		deleted = Secret.password_clear_sync(STORE_SCHEMA, attributes, None)
		self.assertEqual(False, deleted)
示例#9
0
	def testSynchronous(self):
		attributes = { "number": "1", "string": "one", "even": "false" }

		password = Secret.password_lookup_sync(STORE_SCHEMA, attributes, None)
		self.assertEqual("111", password)

		deleted = Secret.password_clear_sync(STORE_SCHEMA, attributes, None)
		self.assertEqual(True, deleted)
示例#10
0
    def testSynchronous(self):
        attributes = {"number": "1", "string": "one", "even": "false"}

        password = Secret.password_lookup_sync(STORE_SCHEMA, attributes, None)
        self.assertEqual("111", password)

        deleted = Secret.password_clear_sync(STORE_SCHEMA, attributes, None)
        self.assertEqual(True, deleted)
示例#11
0
    def testSyncNotFound(self):
        attributes = {"number": "11", "string": "one", "even": "true"}

        password = Secret.password_lookup_sync(STORE_SCHEMA, attributes, None)
        self.assertEqual(None, password)

        deleted = Secret.password_clear_sync(STORE_SCHEMA, attributes, None)
        self.assertEqual(False, deleted)
    def clear():
        """
           Clear all existing accounts.

           :return bool: Either the token was removed successfully or not
       """
        schema = Keyring.get_default().schema
        success = Secret.password_clear_sync(schema, {}, None)
        return success
示例#13
0
 def remove(id_):
     """
     Remove an account from Gnome Keyring by secret id
     :param id_: the encrypted secret code.
     :return: bool
     """
     schema = Keyring.get_default().schema
     removed = Secret.password_clear_sync(schema, {"id": str(id_)}, None)
     return removed
示例#14
0
    def remove(self, token_id: str) -> bool:
        """
        Remove a specific secret OTP token.

        :param secret_id: the secret ID associated to the OTP token
        :return bool: Either the token was removed successfully or not
        """
        success = Secret.password_clear_sync(self.sechema, {"id": str(token_id)},
                                             None)
        return success
示例#15
0
    def reset_settings(self):

        if self.get_setting(self.SETTING.AUTH_USER) is not None:
            result = Secret.password_clear_sync(
                self.EOVPN_SECRET_SCHEMA,
                {"username": self.get_setting(self.SETTING.AUTH_USER)}, None)
            if result:
                logger.info("password deleted from keyring!")

        #backup to /tmp, give user choice to undo
        try:
            shutil.copytree(self.EOVPN_CONFIG_DIR,
                            self.reset_tmp_path,
                            dirs_exist_ok=True)
            shutil.rmtree(self.EOVPN_CONFIG_DIR)
            os.mkdir(self.EOVPN_CONFIG_DIR)
        except Exception as e:
            logger.error(e)

        #reset settings
        self.reset_all_settings()

        #default settings
        self.set_setting(self.SETTING.NOTIFICATIONS, True)
        self.set_setting(
            self.SETTING.MANAGER, "networkmanager" if
            (self.is_nm_supported != None) else "openvpn")

        self.set_setting("treeview-height", 250)
        self.get_widget("main_paned").set_position(250)

        #Setup Tab
        self.auth_user.set_text("")
        self.auth_pass.set_text("")

        self.remote_addr_entry.set_text("")
        self.source_file_chooser.unselect_all()
        self.source_folder_chooser.unselect_all()
        self.ca_chooser.unselect_all()

        # General Tab
        self.update_on_launch_switch.set_state(False)
        self.connect_on_launch_switch.set_state(False)
        self.notification_switch.set_state(False)

        #remove config from liststorage
        self.get_widget("config_storage").clear()
        self.get_widget("menu_view_config").hide()

        self.inapp_notification_label.set_text(
            gettext.gettext("Settings deleted."))
        self.undo_reset_btn.show()
        self.setting_saved_reveal.set_reveal_child(True)
        self.update_settings_ui()
示例#16
0
    def __remove_login(self):
        if (os.path.isfile(self._config_dir + '/config')):
            os.remove(self._config_dir + '/config')
        Secret.password_clear_sync(
            Secret.Schema.new("nl.g4d.Girens", Secret.SchemaFlags.NONE,
                              {'uuid': Secret.SchemaAttributeType.STRING}),
            {'uuid': self._server_uuid}, None)
        Secret.password_clear_sync(
            Secret.Schema.new("nl.g4d.Girens", Secret.SchemaFlags.NONE,
                              {'uuid': Secret.SchemaAttributeType.STRING}),
            {'uuid': self._user_uuid}, None)
        self._settings.set_string("server-url", '')
        self._settings.set_string("server-uuid", '')
        self._settings.set_string("user-uuid", '')

        self._user_uuid = None
        self._token = None
        self._server_uuid = None
        self._server_token = None
        self._server_url = None
    def remove(secret_id):
        """
        Remove a specific secret OTP token.

        :param secret_id: the secret ID associated to the OTP token
        :return bool: Either the token was removed successfully or not
        """
        schema = Keyring.get_default().schema
        success = Secret.password_clear_sync(
            schema, {"id": str(secret_id)}, None)
        return success
示例#18
0
 def login_with_url(self, baseurl, token):
     try:
         self.emit('loading', _('Connecting to ') + baseurl, True)
         self._server = PlexServer(baseurl, token)
         self._account = self._server.account()
         self._library = self._server.library
         self.set_server_token(self._server._token, self._server._baseurl,
                               self._server.machineIdentifier,
                               self._server.friendlyName)
         Secret.password_clear_sync(
             Secret.Schema.new("nl.g4d.Girens", Secret.SchemaFlags.NONE,
                               {'uuid': Secret.SchemaAttributeType.STRING}),
             {'uuid': self._user_uuid}, None)
         self._user_uuid = None
         self._token = None
         self.emit('connection-to-server')
         self.emit('loading', 'Success', False)
         self.emit('login-status', True, '')
     except:
         self.emit('loading',
                   _('Connecting to ') + baseurl + _(' failed.'), True)
         self.emit('login-status', False, 'Login failed')
         print('connection failed (login with url)')
示例#19
0
def _clear_account_password(email):
    return Secret.password_clear_sync(_ACCOUNT_SCHEMA, {"email": email}, None)
示例#20
0
 def do_delete(self, id):
     Secret.password_clear_sync(SCHEMA, {'id': id}, None)
示例#21
0
def _clear_account_password(email):
    return Secret.password_clear_sync(_ACCOUNT_SCHEMA, {"email": email}, None)
示例#22
0
 def clear(self):
     """Returns a boolean of whether any passwords were removed"""
     return Secret.password_clear_sync(self._schema, self._attributes, None)
示例#23
0
 def _remove_secret(self, ex_schema, kwargs):
     result = Secret.password_clear_sync(ex_schema, kwargs, None)
     return result
示例#24
0
 def clear_password(self, scheme, host, username):
     """Remove the password from the cache."""
     template = dict(zip(self.category, (scheme, host, username)))
     Secret.password_clear_sync(self.schema, template, None)
示例#25
0
 def remove_password(self):
     schema = self.password_schema
     Secret.password_clear_sync(schema, {}, None)
     self.set_password_state(False)
示例#26
0
 def clear_password(self, scheme, host, username):
     """Remove the password from the cache."""
     template = dict(zip(self.category, (scheme, host, username)))
     Secret.password_clear_sync(self.schema, template, None)