[geary] Attempt to refresh GOA account credentials when an auth error ocurrs



commit 88c822172a33690ec5058e34cd7570a34e74cedb
Author: Michael Gratton <mike vee net>
Date:   Sat Feb 16 16:33:44 2019 +1100

    Attempt to refresh GOA account credentials when an auth error ocurrs

 src/client/application/geary-controller.vala | 29 ++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 64185fd6..42995f93 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -743,14 +743,31 @@ public class GearyController : Geary.BaseObject {
             : account.get_outgoing_credentials();
 
         bool handled = true;
-        if (this.account_manager.is_goa_account(account) ||
-            context.authentication_attempts > MAX_AUTH_ATTEMPTS ||
+        if (context.authentication_attempts > MAX_AUTH_ATTEMPTS ||
             credentials == null) {
-            // A managed account has had a problem, we have run out of
-            // authentication attempts, or have been asked for creds
-            // but don't even have a login. So just bail out
-            // immediately and flag the account as needing attention.
+            // We have run out of authentication attempts or have
+            // been asked for creds but don't even have a login. So
+            // just bail out immediately and flag the account as
+            // needing attention.
             handled = false;
+        } else if (this.account_manager.is_goa_account(account)) {
+            context.authentication_prompting = true;
+            try {
+                account.load_incoming_credentials(context.cancellable);
+                account.load_outgoing_credentials(context.cancellable);
+            } catch (GLib.Error err) {
+                // Bail out right away, but probably should be opening
+                // the GOA control panel.
+                handled = false;
+                report_problem(
+                    new Geary.AccountProblemReport(
+                        Geary.ProblemType.GENERIC_ERROR,
+                        account,
+                        err
+                    )
+                );
+            }
+            context.authentication_prompting = false;
         } else {
             context.authentication_prompting = true;
             this.application.present();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]