Fixed root only loading

pull/341/head
parent 5bfa29543a
commit 98e95aa4b8

@ -187,13 +187,16 @@ void yon_user_init(main_window *widgets){
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->UserRootPasswordCombo),NULL,SET_PASSWORD_LABEL);
yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->UserRootPasswordEntry));
char *root_password = config(root_password_parameter);
if (yon_char_is_empty(root_password)){
root_password = config(DEFAULTROOTPASSWD_system_parameter);
}
char *autologin = config(autologin_parameter);
if (!yon_char_is_empty(root_password)&&!yon_config_check_default(root_password_parameter)){
if (!yon_char_is_empty(root_password)&&strcmp(root_password,config(DEFAULTROOTPASSWD_system_parameter))){
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),1);
gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),root_password);
} else {
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),0);
gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),"");
gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),root_password);
}
if (!yon_char_is_empty(autologin)&&(!strcmp(autologin,"yes")||!strcmp(autologin,"enable"))){
gtk_switch_set_active(GTK_SWITCH(widgets->UserAutologinSwitch),1);
@ -211,24 +214,27 @@ void yon_user_init(main_window *widgets){
int users_size;
config_str users = yon_config_get_all_by_key(USERADD_parameter_search,&users_size);
if (!users_size){
char *default_user = config(DEFAULTUSER_parameter);
if (yon_char_is_empty(default_user)){
default_user = config(DEFAULTUSER_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);
g_object_set_data(G_OBJECT(user->MainBox),"widgets",widgets);
gtk_box_pack_start(GTK_BOX(widgets->UserAddBox),user->MainBox,0,0,0);
gtk_entry_set_text(GTK_ENTRY(user->UsernameEntry),ADMINISTRATOR_LABEL);
if (!yon_char_is_empty(default_user))
gtk_entry_set_text(GTK_ENTRY(user->LoginEntry),default_user);
else {
gtk_entry_set_text(GTK_ENTRY(user->LoginEntry),"superadmin");
char *def_usr = config(DEFAULTUSER_parameter);
if (!yon_char_is_empty(def_usr)||(!yon_char_is_empty(def_usr)&&strcmp(def_usr,"root"))){
char *default_user = config(DEFAULTUSER_parameter);
if (yon_char_is_empty(default_user)){
default_user = config(DEFAULTUSER_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);
g_object_set_data(G_OBJECT(user->MainBox),"widgets",widgets);
gtk_box_pack_start(GTK_BOX(widgets->UserAddBox),user->MainBox,0,0,0);
gtk_entry_set_text(GTK_ENTRY(user->UsernameEntry),ADMINISTRATOR_LABEL);
if (!yon_char_is_empty(default_user))
gtk_entry_set_text(GTK_ENTRY(user->LoginEntry),default_user);
else {
gtk_entry_set_text(GTK_ENTRY(user->LoginEntry),"superadmin");
}
if (!yon_char_is_empty(default_passwd))
gtk_entry_set_text(GTK_ENTRY(user->PasswordEntry),default_passwd);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user->AdminCheck),1);
}
if (!yon_char_is_empty(default_passwd))
gtk_entry_set_text(GTK_ENTRY(user->PasswordEntry),default_passwd);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user->AdminCheck),1);
}
for (int i=0;i<users_size;i++){
yon_user_struct *user = yon_user_struct_new();

@ -275,6 +275,8 @@ layout && /description:/ {\
#define DEFAULTPASSWD_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [users] DEFAULTPASSWD']"
#define DEFAULTPASSWD_system_parameter "DEFAULTPASSWD"
#define DEFAULTPASSWD_system_parameter_command "ubconfig --source global get [users] DEFAULTPASSWD"
#define DEFAULTROOTPASSWD_system_parameter "DEFAULTROOTPASSWD"
#define DEFAULTROOTPASSWD_system_parameter_command "ubconfig --source global get [users] DEFAULTROOTPASSWD"
#define SYSTEM_LANG_parameter "AUTOINSTALL['ubconfig set [locale] LANG']"
#define SYSTEM_LANG_parameter_command "ubconfig --source global get autoinstall AUTOINSTALL['ubconfig set [locale] LANG']"
@ -310,7 +312,7 @@ layout && /description:/ {\
#define config_get_command(target) yon_char_unite("ubconfig -ea --conarg --source ", target, " get [autoinstall] AUTOINSTALL[*] -- get [locale] LANG", NULL)
#define config_get_default_command "ubconfig -ea --noconarg --source default get [autoinstall] AUTOINSTALL[*] -- get [locale] LANG -- get [users] ADMUID DEFAULTUSER DEFAULTPASSWD"
#define config_get_default_command "ubconfig -ea --noconarg --source default get [autoinstall] AUTOINSTALL[*] -- get [locale] LANG -- get [users] ADMUID DEFAULTUSER DEFAULTPASSWD DEFAULTROOTPASSWD"
#define config_get_global_only_parameters ""
#define config_get_local_only_parameters ""

Loading…
Cancel
Save