[geary/geary-0.13] Merge branch 'wip/fix-not-prompting-for-missing-password' into 'master'
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/geary-0.13] Merge branch 'wip/fix-not-prompting-for-missing-password' into 'master'
- Date: Thu, 21 Feb 2019 05:33:56 +0000 (UTC)
commit 618d33ebddffb461bb2b473cd1f19adde4b930af
Author: Michael Gratton <mike vee net>
Date: Thu Feb 21 03:51:01 2019 +0000
Merge branch 'wip/fix-not-prompting-for-missing-password' into 'master'
Fix not refreshing missing credential tokens
Closes #249
See merge request GNOME/geary!128
(cherry picked from commit fbf2f3072fcd030ec0c55188a379f5c4fb751c4a)
e6a5563b Flip the sense of the libunwind build option
eb1aa4c3 Ensure IMAP and SMTP services notify of auth failure if creds incomplete
7e868dd0 Minor API doc update
f59fdd05 Ensure AccountInformation load credentials methods always (re)load them
c552633a Prompt when loading a libsecret token but it could not be found
src/client/application/secret-mediator.vala | 12 ++++-------
src/engine/api/geary-account-information.vala | 31 ++++++---------------------
src/engine/api/geary-credentials.vala | 1 +
src/engine/imap/api/imap-client-service.vala | 5 +++++
src/engine/smtp/smtp-client-service.vala | 10 +++++----
5 files changed, 23 insertions(+), 36 deletions(-)
---
diff --git a/src/client/application/secret-mediator.vala b/src/client/application/secret-mediator.vala
index 85264ef5..2d541b96 100644
--- a/src/client/application/secret-mediator.vala
+++ b/src/client/application/secret-mediator.vala
@@ -64,17 +64,13 @@ public class SecretMediator : Geary.CredentialsMediator, Object {
service.credentials =
service.credentials.copy_with_token(password);
loaded = true;
- } else {
- debug(
- "Unable to fetch libsecret password for %s: %s %s",
- account.id,
- to_proto_value(service.protocol),
- service.credentials.user
- );
}
- } else {
+ }
+
+ if (!loaded) {
loaded = yield prompt_token(account, service, cancellable);
}
+
return loaded;
}
diff --git a/src/engine/api/geary-account-information.vala b/src/engine/api/geary-account-information.vala
index 4efeab59..c0d0c74e 100644
--- a/src/engine/api/geary-account-information.vala
+++ b/src/engine/api/geary-account-information.vala
@@ -470,21 +470,12 @@ public class Geary.AccountInformation : BaseObject {
* been previously loaded, or false the credentials could not be
* loaded and the service's credentials are invalid.
*/
- public async bool load_outgoing_credentials(GLib.Cancellable? cancellable)
+ public async void load_outgoing_credentials(GLib.Cancellable? cancellable)
throws GLib.Error {
- Credentials? creds = get_outgoing_credentials();
- bool loaded = (creds == null || creds.is_complete());
- if (!loaded && creds != null) {
- ServiceInformation service = this.outgoing;
- if (this.outgoing.credentials_requirement ==
- Credentials.Requirement.USE_INCOMING) {
- service = this.incoming;
- }
- loaded = yield this.mediator.load_token(
- this, service, cancellable
- );
+ Credentials? creds = this.outgoing.credentials;
+ if (creds != null) {
+ yield this.mediator.load_token(this, this.outgoing, cancellable);
}
- return loaded;
}
/**
@@ -493,21 +484,13 @@ public class Geary.AccountInformation : BaseObject {
* Credentials are loaded from the mediator, which may cause the
* user to be prompted for the secret, thus it may yield for some
* time.
- *
- * Returns true if the credentials were successfully loaded or had
- * been previously loaded, or false the credentials could not be
- * loaded and the service's credentials are invalid.
*/
- public async bool load_incoming_credentials(GLib.Cancellable? cancellable)
+ public async void load_incoming_credentials(GLib.Cancellable? cancellable)
throws GLib.Error {
Credentials? creds = this.incoming.credentials;
- bool loaded = creds.is_complete();
- if (!loaded) {
- loaded = yield this.mediator.load_token(
- this, this.incoming, cancellable
- );
+ if (creds != null) {
+ yield this.mediator.load_token(this, this.incoming, cancellable);
}
- return loaded;
}
public bool equal_to(AccountInformation other) {
diff --git a/src/engine/api/geary-credentials.vala b/src/engine/api/geary-credentials.vala
index e1b58cf9..f44ad146 100644
--- a/src/engine/api/geary-credentials.vala
+++ b/src/engine/api/geary-credentials.vala
@@ -107,6 +107,7 @@ public class Geary.Credentials : BaseObject, Gee.Hashable<Geary.Credentials> {
this.token = token;
}
+ /** Determines if a token has been provided. */
public bool is_complete() {
return this.token != null;
}
diff --git a/src/engine/imap/api/imap-client-service.vala b/src/engine/imap/api/imap-client-service.vala
index aa153cbc..398ff8dd 100644
--- a/src/engine/imap/api/imap-client-service.vala
+++ b/src/engine/imap/api/imap-client-service.vala
@@ -385,6 +385,11 @@ internal class Geary.Imap.ClientService : Geary.ClientService {
private async ClientSession create_new_authorized_session(Cancellable? cancellable) throws Error {
debug("[%s] Opening new session", this.account.id);
+ Credentials? login = this.configuration.credentials;
+ if (login != null && !login.is_complete()) {
+ notify_authentication_failed();
+ }
+
ClientSession new_session = new ClientSession(remote);
yield new_session.connect_async(cancellable);
diff --git a/src/engine/smtp/smtp-client-service.vala b/src/engine/smtp/smtp-client-service.vala
index bbead2ad..7ce305fd 100644
--- a/src/engine/smtp/smtp-client-service.vala
+++ b/src/engine/smtp/smtp-client-service.vala
@@ -236,15 +236,17 @@ internal class Geary.Smtp.ClientService : Geary.ClientService {
private async void send_email(Geary.RFC822.Message rfc822, Cancellable? cancellable)
throws Error {
- Smtp.ClientSession smtp = new Geary.Smtp.ClientSession(this.remote);
+ Credentials? login = this.account.get_outgoing_credentials();
+ if (login != null && !login.is_complete()) {
+ notify_authentication_failed();
+ }
+ Smtp.ClientSession smtp = new Geary.Smtp.ClientSession(this.remote);
sending_monitor.notify_start();
Error? smtp_err = null;
try {
- yield smtp.login_async(
- this.account.get_outgoing_credentials(), cancellable
- );
+ yield smtp.login_async(login, cancellable);
} catch (Error login_err) {
debug("SMTP login error: %s", login_err.message);
smtp_err = login_err;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]