From 94891dda356676409b9a6141d36bac933784a79c Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 7 Mar 2025 11:52:18 +0600 Subject: [PATCH] Web publication password logic changes --- source/ubl-settings-update.c | 24 +++++++++++++------ ubl-settings-update-web-publication-add.glade | 5 +--- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/source/ubl-settings-update.c b/source/ubl-settings-update.c index b68d17d..27a1c6b 100644 --- a/source/ubl-settings-update.c +++ b/source/ubl-settings-update.c @@ -1391,13 +1391,16 @@ void on_password_accept(GtkWidget *,dictionary *dict){ GtkWidget *target = yon_dictionary_get_data(dict->first->next,GtkWidget*); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){ + char *encryption = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->EncryptionCombo)); char *hash = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry)); if (yon_char_is_empty(hash)){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(window->PasswordHashEntry); return; } - gtk_entry_set_text(GTK_ENTRY(target),hash); + char *temp = yon_char_unite(encryption,"|",hash,NULL); + gtk_entry_set_text(GTK_ENTRY(target),temp); + free(temp); } else { char *password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); char *password_check = (char*)gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry)); @@ -1417,12 +1420,19 @@ void on_password_accept(GtkWidget *,dictionary *dict){ gtk_entry_set_text(GTK_ENTRY(target),password); } else { - int size; - config_str hash = yon_config_load(yon_debug_output("%s\n",!strcmp(encryption,"sha512")?sha512_encrypt_command(password):sha256_encrypt_command(password)),&size); - yon_char_remove_last_symbol(hash[0],'\n'); - char *temp = yon_char_unite(encryption,"|",hash[0],NULL); - gtk_entry_set_text(GTK_ENTRY(target),temp); - yon_char_parsed_free(hash,size); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){ + char *temp = yon_char_unite(encryption,"|",password,NULL); + gtk_entry_set_text(GTK_ENTRY(target),temp); + free(temp); + } else { + int size; + config_str hash = yon_config_load(yon_debug_output("%s\n",!strcmp(encryption,"sha512")?sha512_encrypt_command(password):sha256_encrypt_command(password)),&size); + yon_char_remove_last_symbol(hash[0],'\n'); + char *temp = yon_char_unite(encryption,"|",hash[0],NULL); + gtk_entry_set_text(GTK_ENTRY(target),temp); + yon_char_parsed_free(hash,size); + free(temp); + } } } diff --git a/ubl-settings-update-web-publication-add.glade b/ubl-settings-update-web-publication-add.glade index 827c1b1..3fc993e 100644 --- a/ubl-settings-update-web-publication-add.glade +++ b/ubl-settings-update-web-publication-add.glade @@ -361,11 +361,10 @@ - True False False User password - 0 + 1 Not encrypted Set @@ -380,7 +379,6 @@ True - False False User password False @@ -398,7 +396,6 @@ 28 28 True - False True True Edit