|
|
|
@ -176,11 +176,7 @@ yon_user_struct *yon_user_struct_new(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_user_init(main_window *widgets){
|
|
|
|
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){
|
|
|
|
if (!main_config.configure_mode){
|
|
|
|
int size = 0;
|
|
|
|
int size = 0;
|
|
|
|
config_str users = yon_config_get_all_by_key(USERADD_parameter_search,&size);
|
|
|
|
config_str users = yon_config_get_all_by_key(USERADD_parameter_search,&size);
|
|
|
|
@ -192,7 +188,7 @@ void yon_user_init(main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_config_remove_by_list(users,size);
|
|
|
|
yon_config_remove_by_list(users,size);
|
|
|
|
yon_config_update_by_args(main_config.config_load_path, autologin_parameter,root_password_parameter,NULL);
|
|
|
|
yon_config_update_by_args(main_config.config_load_path, autologin_parameter,DEFAULTPASSWD_parameter,root_password_parameter,DEFAULTPASSWD_system_parameter,DEFAULTROOTPASSWD_system_parameter,NULL);
|
|
|
|
config_str parameters = yon_config_load(config_get_command(main_config.config_load_path),&size);
|
|
|
|
config_str parameters = yon_config_load(config_get_command(main_config.config_load_path),&size);
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
if (strstr(parameters[i],USERADD_parameter_search)){
|
|
|
|
if (strstr(parameters[i],USERADD_parameter_search)){
|
|
|
|
@ -203,19 +199,9 @@ void yon_user_init(main_window *widgets){
|
|
|
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->UserRootPasswordCombo));
|
|
|
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->UserRootPasswordCombo));
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->UserRootPasswordCombo),NULL,DEFAULT_LABEL);
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->UserRootPasswordCombo),NULL,DEFAULT_LABEL);
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->UserRootPasswordCombo),NULL,SET_PASSWORD_LABEL);
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->UserRootPasswordCombo),NULL,SET_PASSWORD_LABEL);
|
|
|
|
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);
|
|
|
|
char *autologin = config(autologin_parameter);
|
|
|
|
if (!yon_char_is_empty(root_password)&&strcmp(root_password,config(DEFAULTROOTPASSWD_system_parameter))){
|
|
|
|
char *default_passwd = yon_config_get_by_key(DEFAULTPASSWD_parameter);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),1);
|
|
|
|
char *root_password = yon_config_get_by_key(root_password_parameter);
|
|
|
|
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_placeholder_text(GTK_ENTRY(widgets->UserRootPasswordEntry),root_password);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(autologin)&&(!strcmp(autologin,"yes")||!strcmp(autologin,"enable"))){
|
|
|
|
if (!yon_char_is_empty(autologin)&&(!strcmp(autologin,"yes")||!strcmp(autologin,"enable"))){
|
|
|
|
gtk_switch_set_active(GTK_SWITCH(widgets->UserAutologinSwitch),1);
|
|
|
|
gtk_switch_set_active(GTK_SWITCH(widgets->UserAutologinSwitch),1);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -255,12 +241,12 @@ void yon_user_init(main_window *widgets){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(user->LoginEntry),"superadmin");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(user->LoginEntry),"superadmin");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
user->changed=1;
|
|
|
|
user->changed=1;
|
|
|
|
if (!yon_char_is_empty(default_passwd)&&strcmp(default_passwd,config(DEFAULTPASSWD_system_parameter))){
|
|
|
|
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);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user->AdminCheck),0);
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user->AdminCheck),0);
|
|
|
|
gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->UserRootPasswordEntry),default_passwd);
|
|
|
|
gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->UserRootPasswordEntry),yon_config_default_get_by_key(DEFAULTPASSWD_parameter));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user->AdminCheck),1);
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),config(DEFAULTPASSWD_system_parameter));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -300,4 +286,13 @@ void yon_user_init(main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gtk_widget_show(user->MainBox);
|
|
|
|
gtk_widget_show(user->MainBox);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (yon_char_is_empty(root_password)){
|
|
|
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),0);
|
|
|
|
|
|
|
|
gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->UserRootPasswordEntry),yon_config_default_get_by_key(root_password_parameter));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),1);
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),config(DEFAULTROOTPASSWD_system_parameter));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|