[gnome-online-accounts] exchange: Set GOA_ERROR_NOT_AUTHORIZED when credentials were not found



commit 3fd43ea892de4e354ae71d05a18b96ddb0fbf26a
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Apr 16 18:06:50 2012 +0200

    exchange: Set GOA_ERROR_NOT_AUTHORIZED when credentials were not found
    
    Without this the daemon would not notify the user to refresh the
    account.

 src/goabackend/goaexchangeprovider.c |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/src/goabackend/goaexchangeprovider.c b/src/goabackend/goaexchangeprovider.c
index d633ed4..9c1a0e2 100644
--- a/src/goabackend/goaexchangeprovider.c
+++ b/src/goabackend/goaexchangeprovider.c
@@ -269,15 +269,32 @@ ensure_credentials_sync (GoaProvider         *provider,
                                                       cancellable,
                                                       error);
   if (credentials == NULL)
-    goto out;
-
-  if (!g_variant_lookup (credentials, "password", "s", &password))
-    goto out;
+    {
+      if (error != NULL)
+        {
+          g_prefix_error (error, _("Credentials not found in keyring (%s, %d): "),
+                          g_quark_to_string ((*error)->domain), (*error)->code);
+          (*error)->domain = GOA_ERROR;
+          (*error)->code = GOA_ERROR_NOT_AUTHORIZED;
+        }
+      goto out;
+    }
 
   account = goa_object_peek_account (object);
   email_address = goa_account_get_presentation_identity (account);
   username = goa_account_get_identity (account);
 
+  if (!g_variant_lookup (credentials, "password", "s", &password))
+    {
+      if (error != NULL)
+        {
+          g_prefix_error (error, _("Did not find password with username `%s' in credentials"), username);
+          (*error)->domain = GOA_ERROR;
+          (*error)->code = GOA_ERROR_NOT_AUTHORIZED;
+        }
+      goto out;
+    }
+
   exchange = goa_object_peek_exchange (object);
   server = goa_exchange_get_host (exchange);
 



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