summaryrefslogtreecommitdiff
path: root/src/anastasis
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-09-26 16:18:46 +0200
committerChristian Grothoff <christian@grothoff.org>2021-09-26 16:18:46 +0200
commitffed49158f45ec109fea89095de918ef489ac29b (patch)
tree7af66e8fb6db305611111b7fa8d29321bdc87d8b /src/anastasis
parent3b5809bcf0c071eaaaeaee2a15e2b87c32202235 (diff)
downloadanastasis-gtk-ffed49158f45ec109fea89095de918ef489ac29b.tar.gz
anastasis-gtk-ffed49158f45ec109fea89095de918ef489ac29b.tar.bz2
anastasis-gtk-ffed49158f45ec109fea89095de918ef489ac29b.zip
integrate multifactor warn dialog into flow
Diffstat (limited to 'src/anastasis')
-rw-r--r--src/anastasis/anastasis-gtk_action.c8
-rw-r--r--src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c93
2 files changed, 95 insertions, 6 deletions
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)
{