Commit eb1aa4c3 authored by Michael Gratton's avatar Michael Gratton 🤞 Committed by Michael Gratton

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.
parent e6a5563b
......@@ -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);
......
......@@ -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;
......
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