Fixed password changing date at disabling/enabling user

pull/155/head
parent 1eff53c85c
commit 6fb0d4c4b9

@ -1876,7 +1876,12 @@ void on_user_save(GtkWidget *self, dictionary *dict){
password=""; password="";
} }
if (!window->old_password||window->old_password&&strcmp(window->old_password,password)){ char *old_password = NULL;
if (window->old_password){
old_password = window->old_password;
if (old_password[0]=='!') free(yon_char_divide(old_password,0));
}
if (!old_password||old_password&&strcmp(old_password,password)){
time_t t = time(NULL); time_t t = time(NULL);
struct tm tm = *localtime(&t); struct tm tm = *localtime(&t);
char *month = yon_char_from_int(tm.tm_mon+1); char *month = yon_char_from_int(tm.tm_mon+1);
@ -1890,7 +1895,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
password_changed_date = yon_char_unite(yon_char_from_int(1900+tm.tm_year),"-",month,"-",day,NULL); password_changed_date = yon_char_unite(yon_char_from_int(1900+tm.tm_year),"-",month,"-",day,NULL);
} else { } else {
password_changed_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordChangedEntry)); password_changed_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordChangedEntry));
} }
deactivate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck)); deactivate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck));
if (deactivate){ if (deactivate){
@ -2482,10 +2487,10 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
free(yon_char_divide(window->old_password,1)); free(yon_char_divide(window->old_password,1));
} }
if (strcmp(parameters[5],"x")&&strcmp(parameters[5],"")){ if (strcmp(parameters[5],"x")&&strcmp(parameters[5],"")){
if (strstr(parameters[5],"!")){ if (parameters[5][0]=='!'){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck),1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck),1);
} }
yon_char_divide(strstr(parameters[5],"!"),1); free(yon_char_divide(parameters[5],0));
if (!yon_char_is_empty(parameters[5])){ if (!yon_char_is_empty(parameters[5])){
gtk_entry_set_text(GTK_ENTRY(window->userPasswordEntry),parameters[5]); gtk_entry_set_text(GTK_ENTRY(window->userPasswordEntry),parameters[5]);
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),2); gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),2);

Loading…
Cancel
Save