diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-11-16 14:43:06 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-11-16 14:43:06 +0100 |
commit | 1370f74f380a162f6e36edca551a53410bb67105 (patch) | |
tree | 62d36d2fa0ad933f1d417ab92001ebba837c1bc1 /src | |
parent | f2fbc38b8201d109c34d2fc5f6568c5c648cf328 (diff) | |
download | anastasis-gtk-1370f74f380a162f6e36edca551a53410bb67105.tar.gz anastasis-gtk-1370f74f380a162f6e36edca551a53410bb67105.tar.bz2 anastasis-gtk-1370f74f380a162f6e36edca551a53410bb67105.zip |
implement denying 1-FA in anastasis-gtk
Diffstat (limited to 'src')
-rw-r--r-- | src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c | 67 |
1 files changed, 67 insertions, 0 deletions
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 68d10c6..ee1be10 100644 --- a/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c +++ b/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c @@ -170,6 +170,28 @@ anastasis_gtk_confirm_multifactor_dialog_response_cb ( /** + * Function called with the result of telling the + * user that they cannot use 1-FA. + * + * @param the dialog + * @param response_id must be GTK_RESPONSE_OK to proceed + * @param user_data the builder + */ +void +anastasis_gtk_deny_singlefactor_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)); + AG_thaw (); +} + + +/** * Launch dialog to question sanity of user providing * too few authentication methods. */ @@ -211,6 +233,46 @@ question_sanity (void) /** + * Launch dialog to deny 1-FA setups. + */ +static void +refuse_insanity (void) +{ + GtkBuilder *builder; + GtkDialog *ad; + + builder = GNUNET_GTK_get_new_builder ( + "anastasis_gtk_fail_singlefactor.glade", + NULL); + if (NULL == builder) + { + GNUNET_break (0); + return; + } + ad = GTK_DIALOG (gtk_builder_get_object (builder, + "anastasis_gtk_deny_singlefactor_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_auth_button_grid")); + 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. @@ -223,6 +285,11 @@ forward_authentications_editing (void) AG_freeze (); methods = json_object_get (AG_redux_state, "authentication_methods"); + if (json_array_size (methods) < 2) + { + refuse_insanity (); + return; + } if (json_array_size (methods) < 3) { question_sanity (); |