[gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 318/331] Use better error messages for snapd auth failure



commit 152e252cf64b92586801e9e4c5f3feb1ee27980f
Author: William Hua <william hua canonical com>
Date:   Tue Apr 26 14:45:24 2016 +0200

    Use better error messages for snapd auth failure

 src/plugins/gs-ubuntuone-dialog.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-ubuntuone-dialog.c b/src/plugins/gs-ubuntuone-dialog.c
index d015e1e..8261de7 100644
--- a/src/plugins/gs-ubuntuone-dialog.c
+++ b/src/plugins/gs-ubuntuone-dialog.c
@@ -308,6 +308,15 @@ check_snapd_response (GsUbuntuoneDialog *self,
        GVariantIter iter;
        GVariant *discharge = NULL;
 
+       if (status_code == 401) {
+               /* snapd isn't giving us enough information to tell why the authentication failed... */
+               if (g_str_equal (gtk_stack_get_visible_child_name (GTK_STACK (self->page_stack)), "page-1")) {
+                       show_status (self, _("Two-factor authentication failed"), TRUE);
+                       gtk_widget_grab_focus (self->passcode_entry);
+                       return;
+               }
+       }
+
        variant = json_gvariant_deserialize_data (response, -1, NULL, NULL);
 
        if (variant == NULL)
@@ -355,7 +364,8 @@ check_snapd_response (GsUbuntuoneDialog *self,
        return;
 
 err:
-       show_status (self, _("An error occurred"), TRUE);
+       /* snapd isn't giving us enough information to tell why the authentication failed... */
+       show_status (self, status_code == 401 ? _("Incorrect email or password") : _("An error occurred"), 
TRUE);
        gtk_widget_grab_focus (self->password_entry);
 }
 


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