diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index b3bc25c..60aca54 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -256,13 +256,13 @@ void on_expiration_clicked(GtkWidget *self, ubl_settings_usergroups_user_window } else { yon_config_remove_by_key("DEFAULTUSER"); } - char *default_password = (char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultPasswordEntry)); + char *default_password = gtk_combo_box_get_active(GTK_COMBO_BOX(window->DefaultPasswordCombo))>1? (char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultPasswordEntry)):NULL; if (!yon_char_is_empty(default_password)){ yon_config_register("DEFAULTPASSWD","users",default_password); } else { yon_config_remove_by_key("DEFAULTPASSWD"); } - char *root_password = (char*)gtk_entry_get_text(GTK_ENTRY(window->RootPasswordEntry)); + char *root_password = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RootPasswordCombo)) > 1 ? (char*)gtk_entry_get_text(GTK_ENTRY(window->RootPasswordEntry)) : NULL; if (!yon_char_is_empty(root_password)){ yon_config_register("DEFAULTROOTPASSWD","users",root_password); } else { @@ -280,6 +280,20 @@ void on_expiration_clicked(GtkWidget *self, ubl_settings_usergroups_user_window } } + void on_hash_changed(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window){ + + int hash_size=0; + config_str hash_algos = yon_file_open(hash_list_path,&hash_size); + for (int i=1;iPasswordHashCombo,parsed[1]); + yon_char_parsed_free(parsed,parsed_size); + } + yon_char_parsed_free(hash_algos,hash_size); + } + ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(){ ubl_settings_usergroups_additional_settings_window *window = malloc(sizeof(ubl_settings_usergroups_additional_settings_window)); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_additional_settings); @@ -307,6 +321,7 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ int parsed_size; config_str parsed = yon_char_parse(hash_algos[i],&parsed_size,";"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(window->PasswordHashCombo),parsed[0]); + gtk_widget_set_tooltip_text(window->PasswordHashCombo,parsed[1]); yon_char_parsed_free(parsed,parsed_size); } } @@ -344,6 +359,7 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ g_signal_connect(G_OBJECT(window->RootPasswordButton),"clicked",G_CALLBACK(on_password_change),root_dict); g_signal_connect(G_OBJECT(window->RootPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->RootPasswordButton); + g_signal_connect(G_OBJECT(window->PasswordHashCombo),"changed",G_CALLBACK(on_hash_changed),window); g_signal_connect(G_OBJECT(window->DefaultPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->DefaultPasswordButton); return window;