From bb759ea912006a81034e5f2e273a45c0a711afcf Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Thu, 26 Mar 2026 17:55:21 +0600 Subject: [PATCH] Fixed user password loading --- source/ubinstall-gtk-region.c | 3 ++- source/ubinstall-gtk-users.c | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/source/ubinstall-gtk-region.c b/source/ubinstall-gtk-region.c index 3896c57..5d9a461 100644 --- a/source/ubinstall-gtk-region.c +++ b/source/ubinstall-gtk-region.c @@ -218,7 +218,7 @@ void yon_region_init(main_window *widgets){ cc_timezone_map_set_timezone(CC_TIMEZONE_MAP(widgets->RegionMapTarget),config_param); } - size_t size; + size_t size=0; GtkTreeIter iter; config_str parsed = yon_timezone_get_all(&size); bind_textdomain_codeset(timezone_locale_name,"UTF-8"); @@ -263,6 +263,7 @@ void yon_region_init(main_window *widgets){ gtk_switch_set_active(GTK_SWITCH(widgets->RegionSensitiveSwitch),0); } if (!gtk_switch_get_active(GTK_SWITCH(widgets->RegionSensitiveSwitch))){ + size=0; config_str autotimezone = yon_config_load(internet_tomezone_check_command,(int*)&size); if (size&&!yon_char_is_empty(autotimezone[0])){ yon_char_remove_last_symbol(autotimezone[0],'\n'); diff --git a/source/ubinstall-gtk-users.c b/source/ubinstall-gtk-users.c index 9afbe30..496033a 100644 --- a/source/ubinstall-gtk-users.c +++ b/source/ubinstall-gtk-users.c @@ -145,6 +145,11 @@ yon_user_struct *yon_user_struct_new(){ } void yon_user_init(main_window *widgets){ + char *default_passwd = config(DEFAULTPASSWD_parameter); + + if (yon_char_is_empty(default_passwd)){ + default_passwd = config(DEFAULTPASSWD_system_parameter); + } if (!main_config.configure_mode){ int size = 0; config_str users = yon_config_get_all_by_key(USERADD_parameter_search,&size); @@ -194,13 +199,9 @@ void yon_user_init(main_window *widgets){ config_str users = yon_config_get_all_by_key(USERADD_parameter_search,&users_size); if (!users_size){ char *default_user = config(DEFAULTUSER_parameter); - char *default_passwd = config(DEFAULTPASSWD_parameter); if (yon_char_is_empty(default_user)){ default_user = config(DEFAULTUSER_system_parameter); } - if (yon_char_is_empty(default_passwd)){ - default_passwd = config(DEFAULTPASSWD_system_parameter); - } yon_user_struct *user = yon_user_struct_new(); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user->AdminCheck),1); g_signal_connect(G_OBJECT(user->AdminCheck),"clicked",G_CALLBACK(yon_user_admin_check),widgets); @@ -240,8 +241,13 @@ void yon_user_init(main_window *widgets){ } } if (parsed_size>5&&!yon_char_is_empty(parsed[5])){ - gtk_entry_set_text(GTK_ENTRY(user->PasswordEntry),parsed[5]); - gtk_combo_box_set_active(GTK_COMBO_BOX(user->PasswordCombo),1); + if (strcmp(parsed[5],default_passwd)&&parsed[5]){ + gtk_entry_set_text(GTK_ENTRY(user->PasswordEntry),parsed[5]); + gtk_combo_box_set_active(GTK_COMBO_BOX(user->PasswordCombo),1); + } else { + gtk_entry_set_text(GTK_ENTRY(user->PasswordEntry),default_passwd); + gtk_combo_box_set_active(GTK_COMBO_BOX(user->PasswordCombo),0); + } } gtk_widget_show(user->MainBox); }