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
This commit is contained in:
commit
fbf2f3072f
5 changed files with 23 additions and 36 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue