Commit f08c17a8 authored by Cédric Bellegarde's avatar Cédric Bellegarde

Be sure to update password instead of adding a new one

parent 11d396a2
Pipeline #48870 passed with stage
in 15 minutes and 53 seconds
...@@ -149,6 +149,34 @@ class PasswordsHelper: ...@@ -149,6 +149,34 @@ class PasswordsHelper:
uuid, uuid,
callback, callback,
*args) *args)
# Clear item if exists
SecretSchema = {
"type": Secret.SchemaAttributeType.STRING,
"login": Secret.SchemaAttributeType.STRING,
"hostname": Secret.SchemaAttributeType.STRING,
"formSubmitURL": Secret.SchemaAttributeType.STRING,
"userform": Secret.SchemaAttributeType.STRING,
"passform": Secret.SchemaAttributeType.STRING,
}
SecretAttributes = {
"type": "eolie web login",
"login": user_form_value,
"hostname": hostname_uri,
"formSubmitURL": form_uri,
"userform": user_form_name,
"passform": pass_form_name
}
schema = Secret.Schema.new("org.gnome.Eolie",
Secret.SchemaFlags.NONE,
SecretSchema)
self.__secret.search(schema,
SecretAttributes,
Secret.SearchFlags.ALL,
None,
self.__on_search_clear,
callback,
*args)
schema_string = "org.gnome.Eolie: %s > %s" % (user_form_value, schema_string = "org.gnome.Eolie: %s > %s" % (user_form_value,
hostname_uri) hostname_uri)
SecretSchema = { SecretSchema = {
...@@ -253,7 +281,7 @@ class PasswordsHelper: ...@@ -253,7 +281,7 @@ class PasswordsHelper:
SecretAttributes, SecretAttributes,
Secret.SearchFlags.ALL, Secret.SearchFlags.ALL,
None, None,
self.__on_clear_search, self.__on_search_clear,
callback, callback,
*args) *args)
except Exception as e: except Exception as e:
...@@ -278,7 +306,7 @@ class PasswordsHelper: ...@@ -278,7 +306,7 @@ class PasswordsHelper:
SecretAttributes, SecretAttributes,
Secret.SearchFlags.ALL, Secret.SearchFlags.ALL,
None, None,
self.__on_clear_search, self.__on_search_clear,
callback, callback,
*args) *args)
except Exception as e: except Exception as e:
...@@ -303,7 +331,7 @@ class PasswordsHelper: ...@@ -303,7 +331,7 @@ class PasswordsHelper:
SecretAttributes, SecretAttributes,
Secret.SearchFlags.ALL, Secret.SearchFlags.ALL,
None, None,
self.__on_clear_search) self.__on_search_clear)
except Exception as e: except Exception as e:
Logger.debug("PasswordsHelper::clear_all(): %s", e) Logger.debug("PasswordsHelper::clear_all(): %s", e)
...@@ -353,7 +381,7 @@ class PasswordsHelper: ...@@ -353,7 +381,7 @@ class PasswordsHelper:
else: else:
callback(None, None, form_uri, 0, 0, *args) callback(None, None, form_uri, 0, 0, *args)
def __on_clear_search(self, source, result, callback=None, *args): def __on_search_clear(self, source, result, callback=None, *args):
""" """
Clear passwords Clear passwords
@param source as GObject.Object @param source as GObject.Object
...@@ -367,7 +395,7 @@ class PasswordsHelper: ...@@ -367,7 +395,7 @@ class PasswordsHelper:
if callback is not None: if callback is not None:
callback(*args) callback(*args)
except Exception as e: except Exception as e:
Logger.debug("PasswordsHelper::__on_clear_search(): %s", e) Logger.debug("PasswordsHelper::__on_search_clear(): %s", e)
def __on_secret_search(self, source, result, form_uri, callback, *args): def __on_secret_search(self, source, result, form_uri, callback, *args):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment