[gnome-software/wip/rancell/2fa: 2/2] Show two factor page if plugin requires it



commit bbe3c5ae4551b67ddde1d854c82dfb130417a1e8
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Jun 30 14:51:05 2016 +1200

    Show two factor page if plugin requires it

 src/gs-auth-dialog.c |    9 +++++++++
 src/gs-plugin.h      |    2 ++
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-auth-dialog.c b/src/gs-auth-dialog.c
index 62c1681..47d293b 100644
--- a/src/gs-auth-dialog.c
+++ b/src/gs-auth-dialog.c
@@ -115,6 +115,15 @@ gs_auth_dialog_authenticate_cb (GObject *source,
        if (!gs_plugin_loader_app_action_finish (plugin_loader, res, &error)) {
                const gchar *url;
 
+               if (g_error_matches (error,
+                                    GS_PLUGIN_ERROR,
+                                    GS_PLUGIN_ERROR_PIN_REQUIRED)) {
+                       gtk_stack_set_visible_child_name (GTK_STACK (dialog->stack), "2fa");
+                       return;
+               }
+
+               url = gs_utils_get_error_value (error);
+
                /* have we been given a link */
                url = gs_utils_get_error_value (error);
                if (url != NULL) {
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index 4ee00b8..646157f 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -108,6 +108,7 @@ typedef enum {
  * @GS_PLUGIN_ERROR_NO_SPACE:          No disk space to allow action
  * @GS_PLUGIN_ERROR_AUTH_REQUIRED:     Authentication was required
  * @GS_PLUGIN_ERROR_AUTH_INVALID:      Provided authentication was invalid
+ * @GS_PLUGIN_ERROR_PIN_REQUIRED:      PIN required for authentication
  *
  * The failure error types.
  **/
@@ -120,6 +121,7 @@ typedef enum {
        GS_PLUGIN_ERROR_NO_SPACE,
        GS_PLUGIN_ERROR_AUTH_REQUIRED,
        GS_PLUGIN_ERROR_AUTH_INVALID,
+       GS_PLUGIN_ERROR_PIN_REQUIRED,
        /*< private >*/
        GS_PLUGIN_ERROR_LAST
 } GsPluginError;


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