gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] branch master updated: integrate multifactor warn


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: integrate multifactor warn dialog into flow
Date: Sun, 26 Sep 2021 16:18:48 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository anastasis-gtk.

The following commit(s) were added to refs/heads/master by this push:
     new ffed491  integrate multifactor warn dialog into flow
ffed491 is described below

commit ffed49158f45ec109fea89095de918ef489ac29b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Sep 26 16:18:46 2021 +0200

    integrate multifactor warn dialog into flow
---
 contrib/anastasis_gtk_warn_multifactor.glade       |  1 -
 src/anastasis/anastasis-gtk_action.c               |  8 +-
 ...stasis-gtk_handle-main-window-forward-clicked.c | 93 +++++++++++++++++++++-
 3 files changed, 95 insertions(+), 7 deletions(-)

diff --git a/contrib/anastasis_gtk_warn_multifactor.glade 
b/contrib/anastasis_gtk_warn_multifactor.glade
index 9690d91..a79b444 100644
--- a/contrib/anastasis_gtk_warn_multifactor.glade
+++ b/contrib/anastasis_gtk_warn_multifactor.glade
@@ -11,7 +11,6 @@
     <property name="message-type">warning</property>
     <property name="text" translatable="yes">To keep your secret secure, we 
recommend you specify at least three authentication options before 
proceeding.</property>
     <property name="secondary-text" translatable="yes">Select "back" to add 
additional authentication options.</property>
-    <signal name="close" 
handler="anastasis_gtk_confirm_multifactor_dialog_close_cb" swapped="no"/>
     <signal name="response" 
handler="anastasis_gtk_confirm_multifactor_dialog_response_cb" swapped="no"/>
     <child internal-child="vbox">
       <object class="GtkBox">
diff --git a/src/anastasis/anastasis-gtk_action.c 
b/src/anastasis/anastasis-gtk_action.c
index 87e06bc..4f754b2 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -3056,11 +3056,11 @@ action_challenge_solving (void)
   /* show dialog */
   {
     GtkWidget *toplevel;
-    GtkBox *box;
+    GtkWidget *box;
 
-    box = GTK_BOX (GCG_get_main_window_object (
-                     "anastasis_gtk_open_challenge_box"));
-    toplevel = gtk_widget_get_toplevel (GTK_WIDGET (box));
+    box = GTK_WIDGET (GCG_get_main_window_object (
+                        "anastasis_gtk_open_challenge_box"));
+    toplevel = gtk_widget_get_toplevel (box);
     gtk_window_set_transient_for (GTK_WINDOW (diag),
                                   GTK_WINDOW (toplevel));
     gtk_window_present (GTK_WINDOW (diag));
diff --git a/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c 
b/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
index 1080a36..34c5bd6 100644
--- a/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
+++ b/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c
@@ -137,12 +137,97 @@ AG_forward_user_attributes_collecting (void)
 }
 
 
+/**
+ * Function called with the result of questioning the user
+ * if they really want to proceed with less than three
+ * authentication factors.
+ *
+ * @param the dialog
+ * @param response_id must be GTK_RESPONSE_OK to proceed
+ * @param user_data the builder
+ */
+void
+anastasis_gtk_confirm_multifactor_dialog_response_cb (
+  GtkDialog *dialog,
+  gint response_id,
+  gpointer user_data)
+{
+  GtkBuilder *builder = user_data;
+
+  gtk_widget_destroy (GTK_WIDGET (dialog));
+  g_object_unref (G_OBJECT (builder));
+  if (GTK_RESPONSE_OK != response_id)
+  {
+    AG_thaw ();
+    return;
+  }
+  AG_ra = ANASTASIS_redux_action (AG_redux_state,
+                                  "next",
+                                  NULL,
+                                  &AG_action_cb,
+                                  NULL);
+}
+
+
+/**
+ * Launch dialog to question sanity of user providing
+ * too few authentication methods.
+ */
+static void
+question_sanity (void)
+{
+  GtkBuilder *builder;
+  GtkDialog *ad;
+
+  builder = GNUNET_GTK_get_new_builder (
+    "anastasis_gtk_warn_multifactor.glade",
+    NULL);
+  if (NULL == builder)
+  {
+    GNUNET_break (0);
+    return;
+  }
+  ad = GTK_DIALOG (gtk_builder_get_object (builder,
+                                           
"anastasis_gtk_confirm_multifactor_dialog"));
+  if (NULL == ad)
+  {
+    GNUNET_break (0);
+    g_object_unref (G_OBJECT (builder));
+    return;
+  }
+  /* show dialog */
+  {
+    GtkWidget *toplevel;
+    GtkWidget *widget;
+
+    widget = GTK_WIDGET (GCG_get_main_window_object (
+                           "anastasis_gtk_open_challenge_box"));
+    toplevel = gtk_widget_get_toplevel (widget);
+    gtk_window_set_transient_for (GTK_WINDOW (ad),
+                                  GTK_WINDOW (toplevel));
+    gtk_window_present (GTK_WINDOW (ad));
+  }
+}
+
+
+/**
+ * The user has clicked 'next' in the 'authentications_editing' state.
+ * Check if the number of authentication methods configured is above
+ * a threshold. If no, warn before allowing to proceed.
+ */
 static void
 forward_authentications_editing (void)
 {
+  json_t *methods;
+
   AG_freeze ();
-  // FIXME: if insufficient authentication methods,
-  // throw warning at the user!
+  methods = json_object_get (AG_redux_state,
+                             "authentication_methods");
+  if (json_array_size (methods) < 3)
+  {
+    question_sanity ();
+    return;
+  }
   AG_ra = ANASTASIS_redux_action (AG_redux_state,
                                   "next",
                                   NULL,
@@ -151,6 +236,10 @@ forward_authentications_editing (void)
 }
 
 
+/**
+ * The user has pressed 'next' in POLICIES_EDITING state.
+ * Proceed to secret editing.
+ */
 static void
 forward_policies_reviewing (void)
 {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]