[geary/wip/rework-password-prompting: 3/5] Fix some crashes prompting for passwords in the controller
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/rework-password-prompting: 3/5] Fix some crashes prompting for passwords in the controller
- Date: Wed, 6 Mar 2019 13:01:45 +0000 (UTC)
commit a0fbf847c59f9185cc8e2c50a39232a30d95f11c
Author: Michael Gratton <mike vee net>
Date: Wed Mar 6 23:09:03 2019 +1100
Fix some crashes prompting for passwords in the controller
Ensure the credential's token is actually updated, is updated on the
right service, and that the right credentials and service are presented
in the password dialog.
src/client/application/geary-controller.vala | 19 +++++++++++++------
src/client/dialogs/password-dialog.vala | 10 +++-------
2 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 891605ea..113eb245 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -769,26 +769,33 @@ public class GearyController : Geary.BaseObject {
PasswordDialog password_dialog = new PasswordDialog(
this.application.get_active_window(),
account,
- service
+ service,
+ credentials
);
if (password_dialog.run()) {
- service.credentials = service.credentials.copy_with_token(
- password_dialog.password
- );
service.remember_password = password_dialog.remember_password;
// The update the credentials for the service that the
// credentials actually came from
Geary.ServiceInformation creds_service =
- credentials == account.incoming.credentials
+ (credentials == account.incoming.credentials)
? account.incoming
: account.outgoing;
+ creds_service.credentials = credentials.copy_with_token(
+ password_dialog.password
+ );
+
SecretMediator libsecret = (SecretMediator) account.mediator;
try {
+ // Update the secret using the service where the
+ // credentials originated, since the service forms
+ // part of the key's identity
yield libsecret.update_token(
account, creds_service, context.cancellable
);
- // Update the actual service in the engine though
+ // Update the engine using the original service
+ // however, since that is the one waiting for the
+ // credentials
yield this.application.engine.update_account_service(
account, service, context.cancellable
);
diff --git a/src/client/dialogs/password-dialog.vala b/src/client/dialogs/password-dialog.vala
index a9fb8437..d566c040 100644
--- a/src/client/dialogs/password-dialog.vala
+++ b/src/client/dialogs/password-dialog.vala
@@ -25,7 +25,8 @@ public class PasswordDialog {
public PasswordDialog(Gtk.Window? parent,
Geary.AccountInformation account,
- Geary.ServiceInformation service) {
+ Geary.ServiceInformation service,
+ Geary.Credentials? credentials) {
Gtk.Builder builder = GioUtil.create_builder("password-dialog.glade");
dialog = (Gtk.Dialog) builder.get_object("PasswordDialog");
@@ -43,18 +44,13 @@ public class PasswordDialog {
Gtk.Label primary_text_label = (Gtk.Label) builder.get_object("primary_text_label");
primary_text_label.set_markup(PRIMARY_TEXT_MARKUP.printf(PRIMARY_TEXT_FIRST_TRY));
- bool is_smtp = service.protocol == Geary.Protocol.SMTP;
-
- Geary.Credentials? credentials = (is_smtp)
- ? account.get_outgoing_credentials() : account.incoming.credentials;
-
if (credentials != null) {
label_username.set_text(credentials.user);
entry_password.set_text(credentials.token ?? "");
}
check_remember_password.active = service.remember_password;
- if (is_smtp) {
+ if ((service.protocol == Geary.Protocol.SMTP)) {
label_smtp.show();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]