Fixed unchosen expiration date was set as today

pull/278/head
parent 0a89d61267
commit 89b940643e
No known key found for this signature in database
GPG Key ID: FF1D842BF4DDE92B

@ -514,17 +514,19 @@ void on_user_save(GtkWidget *self, dictionary *dict){
password_change_interval_maximum = yon_char_from_long(password_change_interval_maximum_active);
} else password_change_interval_maximum = 0;
guint year, month, day;
gtk_calendar_get_date(GTK_CALENDAR(window->ExpirationCalendar),&year,&month,&day);
char *dy = yon_char_from_int(day);
char *mn = yon_char_from_int(month+1);
char *yr = yon_char_from_int(year);
if (month+1<10) mn = yon_char_append("0",mn);
if (day<10) dy = yon_char_append("0",dy);
password_expiration_date = yon_char_unite(yr,"-",mn,"-",dy,NULL);
// password_expiration_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordExpirationEntry));
if (yon_char_is_empty(password_expiration_date)){
password_expiration_date="-1";
if (!yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(window->userPasswordExpirationEntry)))){
guint year, month, day;
gtk_calendar_get_date(GTK_CALENDAR(window->ExpirationCalendar),&year,&month,&day);
char *dy = yon_char_from_int(day);
char *mn = yon_char_from_int(month+1);
char *yr = yon_char_from_int(year);
if (month+1<10) mn = yon_char_append("0",mn);
if (day<10) dy = yon_char_append("0",dy);
password_expiration_date = yon_char_unite(yr,"-",mn,"-",dy,NULL);
// password_expiration_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordExpirationEntry));
if (yon_char_is_empty(password_expiration_date)){
password_expiration_date="-1";
}
}
long warning_days_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userWarningSpin));
@ -674,11 +676,13 @@ int yon_system_user_sync(char *target_user){
free(optionals);
if (!yon_char_is_empty(config_user)){
char *user_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERADD(target_user));
char *parameter_name = USERADD(target_user);
char *user_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",parameter_name);
yon_config_register(parameter_name,user_command,config_user);
yon_config_remove_ignore(parameter_name);
free(config_user);
free(user_command);
free(parameter_name);
} else return 0;
if (!yon_char_is_empty(config_shadow)){

Loading…
Cancel
Save