fix double password storage

This commit is contained in:
Erica Z 2024-11-01 20:51:27 +01:00
parent 62e5fce1f3
commit 5d949d4c0f

View file

@ -117,16 +117,26 @@ public class Audrey.Ui.Setup : Adw.PreferencesDialog {
}); });
} }
public void save () { private async void save_internal () {
this.authn_can_edit = false; this.authn_can_edit = false;
Secret.password_store.begin (secret_schema, null, "Audrey Subsonic password", this.password, null, (obj, res) => {
try { try {
Secret.password_store.end (res); yield Secret.password_clear (secret_schema, null);
} catch (Error e) {
error ("could not clear previous passwords from keyring: %s", e.message);
}
try {
yield Secret.password_store (secret_schema, null, "Audrey Subsonic password", this.password, null, "server-url", this.server_url, "username", this.username);
} catch (Error e) { } catch (Error e) {
error ("could not store password in keyring: %s", e.message); error ("could not store password in keyring: %s", e.message);
} }
this.authn_can_edit = true; this.authn_can_edit = true;
}, "server-url", this.server_url, "username", this.username); }
public void save () {
this.save_internal.begin ();
} }
~Setup () { ~Setup () {