[geary/wip/fix-not-prompting-for-missing-password: 2/5] Ensure IMAP and SMTP services notify of auth failure if creds incomplete
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/fix-not-prompting-for-missing-password: 2/5] Ensure IMAP and SMTP services notify of auth failure if creds incomplete
- Date: Thu, 21 Feb 2019 03:36:10 +0000 (UTC)
commit eb1aa4c31f56975cead6a1f128ea481499f7d8d9
Author: Michael Gratton <mike vee net>
Date: Thu Feb 21 14:22:49 2019 +1100
Ensure IMAP and SMTP services notify of auth failure if creds incomplete
This avoids attemting to connect and login when we know it is going to
fail.
src/engine/imap/api/imap-client-service.vala | 5 +++++
src/engine/smtp/smtp-client-service.vala | 10 ++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
---
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]