From 1eff53c85c335cef1a5066c2aa1223345a9009ac Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 19 Mar 2024 10:17:12 +0600 Subject: [PATCH] Fixed password saving for groups --- source/ubl-settings-usergroups.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index f19d3c9..51fa885 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -156,7 +156,7 @@ void yon_interface_update(main_window *widgets){ } } else { - pars = PASSWORD_NO_SET_LABEL; + pars = DEFAULT_USER_LABEL; } gtk_list_store_set(widgets->GroupsList,&iter, @@ -1307,7 +1307,18 @@ void on_group_save(GtkWidget *self, dictionary *dict){ yon_config_remove_by_key(GROUPADD_SYNC(group_name)); } - password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); + + int password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->PasswordCombo)); + if (password_active > 1){ + password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); + if (yon_char_is_empty(password)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->PasswordEntry); + return; + } + } else { + password=""; + } final_string = yon_char_unite(yon_char_return_if_exist(group_users,"x"), ":",yon_char_return_if_exist(gid,"x"), ":",yon_char_return_if_exist(non_unique,""), @@ -1323,7 +1334,6 @@ void on_group_save(GtkWidget *self, dictionary *dict){ gtk_list_store_append(widgets->GroupsList,&iter); char *passwor = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); char *password_status=NULL; - int password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->PasswordCombo)); if (password_active==0) password_status=DEFAULT_USER_LABEL; else if (password_active==1) @@ -2580,7 +2590,7 @@ void on_main_edit(GtkWidget *self, main_window *widgets){ gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),parsed[4]); gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),2); } else { - gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),1); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),0); } } char *sync = yon_config_get_by_key(GROUPADD_SYNC(name));