[gnome-software] Show two factor page if plugin requires it



commit 47cee8dc9392ef5e72b982e23d515fc2c310539b
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-auth-dialog.ui |    4 ++--
 src/gs-plugin.h       |    2 ++
 3 files changed, 13 insertions(+), 2 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-auth-dialog.ui b/src/gs-auth-dialog.ui
index 1dca158..71897cf 100644
--- a/src/gs-auth-dialog.ui
+++ b/src/gs-auth-dialog.ui
@@ -191,7 +191,7 @@
                     </child>
                   </object>
                   <packing>
-                    <property name="name">page0</property>
+                    <property name="name">login</property>
                   </packing>
                 </child>
                 <child>
@@ -242,7 +242,7 @@
                     </child>
                   </object>
                   <packing>
-                    <property name="name">page1</property>
+                    <property name="name">2fa</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
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]