|
|
|
|
@ -740,6 +740,13 @@ void on_password_encryption_changed(GtkComboBox *self, password_window *dialog){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->NoEncriptionCheck),0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_hash_entry_sensitiveness_update(GtkWidget *, password_window *dialog){
|
|
|
|
|
int hash_type_sensitive = gtk_combo_box_get_active(GTK_COMBO_BOX(dialog->EncryptionCombo));
|
|
|
|
|
int encrypt_sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->NoEncriptionCheck));
|
|
|
|
|
if (!encrypt_sensitive&&hash_type_sensitive) gtk_widget_set_sensitive(dialog->PasswordHashEntry,1);
|
|
|
|
|
else gtk_widget_set_sensitive(dialog->PasswordHashEntry,0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_open(GtkWidget *, web_publication_add_window *window){
|
|
|
|
|
password_window *dialog = yon_password_window_new();
|
|
|
|
|
yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(dialog->PasswordEntry));
|
|
|
|
|
@ -749,8 +756,10 @@ void on_password_open(GtkWidget *, web_publication_add_window *window){
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",dialog);
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"target",window->UserPasswordEntry);
|
|
|
|
|
g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_password_accept),dict);
|
|
|
|
|
g_signal_connect(G_OBJECT(dialog->NoEncriptionCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),dialog->PasswordHashEntry);
|
|
|
|
|
g_signal_connect(G_OBJECT(dialog->NoEncriptionCheck),"toggled",G_CALLBACK(yon_hash_entry_sensitiveness_update),dialog);
|
|
|
|
|
g_signal_connect(G_OBJECT(dialog->EncryptionCombo),"changed",G_CALLBACK(yon_hash_entry_sensitiveness_update),dialog);
|
|
|
|
|
g_signal_connect(G_OBJECT(dialog->EncryptionCombo),"changed",G_CALLBACK(on_password_encryption_changed),dialog);
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(window->Window),PASSWORD_INPUT_LABEL,icon_path,"password_window");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_web_publish_remove(GtkWidget *self,main_window *widgets){
|
|
|
|
|
@ -1371,67 +1380,81 @@ void on_mirror_configure_accept(GtkWidget *, dictionary *dict){
|
|
|
|
|
gtk_widget_destroy(window->Window);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_accept(GtkWidget *,dictionary *dict){
|
|
|
|
|
password_window *window = yon_dictionary_get_data(dict->first,password_window*);
|
|
|
|
|
GtkWidget *target = yon_dictionary_get_data(dict->first->next,GtkWidget*);
|
|
|
|
|
char *yon_password_unencrypted_password_get(password_window *window){
|
|
|
|
|
const char *password = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
const char *password_repeat = gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry));
|
|
|
|
|
if (strpbrk(password,"!@#%^&*\'")){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_RESTRICTED_SYMBOL_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (strcmp(password,password_repeat)){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_MISMATCH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->RepeatPasswordEntry);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (yon_char_is_empty(password)){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){
|
|
|
|
|
const char *encryption = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->EncryptionCombo));
|
|
|
|
|
char *final = yon_char_unite(encryption,"|",password,NULL);
|
|
|
|
|
return final;
|
|
|
|
|
} else {
|
|
|
|
|
return yon_char_new(password);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *yon_password_hash_get(password_window *window){
|
|
|
|
|
int encription_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->EncryptionCombo));
|
|
|
|
|
const char *encription = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->EncryptionCombo));
|
|
|
|
|
if (encription_active == 0){
|
|
|
|
|
const char *hash = gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry));
|
|
|
|
|
if (!yon_char_is_empty(hash)){
|
|
|
|
|
char *final = yon_char_unite(encription,"|",hash);
|
|
|
|
|
return final;
|
|
|
|
|
} else {
|
|
|
|
|
const char *password = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
const char *password_repeat = gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry));
|
|
|
|
|
if (strpbrk(password,"!@#%^&*\'")){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_RESTRICTED_SYMBOL_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
|
|
|
|
|
return;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (strcmp(password,password_repeat)){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_MISMATCH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->RepeatPasswordEntry);
|
|
|
|
|
return;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(target),password);
|
|
|
|
|
} else {
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){
|
|
|
|
|
const char *hash = 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;
|
|
|
|
|
}
|
|
|
|
|
if (strlen((hash))!=128||strlen(hash)!=64){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),INCORRECT_HASH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->PasswordHashEntry);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
char *final = yon_char_unite(encription,"|",hash,NULL);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(target),final);
|
|
|
|
|
free(final);
|
|
|
|
|
} else {
|
|
|
|
|
const char *password = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
const char *password_repeat = gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry));
|
|
|
|
|
if (strpbrk(password,"!@#%^&*\'")){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_RESTRICTED_SYMBOL_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strcmp(password,password_repeat)){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_MISMATCH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->RepeatPasswordEntry);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int size;
|
|
|
|
|
config_str hash = yon_config_load(yon_debug_output("%s\n",encription_active==1?sha512_encrypt_command(password):sha256_encrypt_command(password)),&size);
|
|
|
|
|
yon_char_remove_last_symbol(hash[0],'\n');
|
|
|
|
|
int size;
|
|
|
|
|
config_str hash = yon_config_load(yon_debug_output("%s\n",encription_active==1?sha512_encrypt_command(password):sha256_encrypt_command(password)),&size);
|
|
|
|
|
yon_char_remove_last_symbol(hash[0],'\n');
|
|
|
|
|
|
|
|
|
|
char *final = yon_char_unite(encription,"|",hash[0],NULL);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(target),final);
|
|
|
|
|
free(final);
|
|
|
|
|
}
|
|
|
|
|
char *final = yon_char_unite(encription,"|",hash[0],NULL);
|
|
|
|
|
return final;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_accept(GtkWidget *,dictionary *dict){
|
|
|
|
|
password_window *window = yon_dictionary_get_data(dict->first,password_window*);
|
|
|
|
|
GtkWidget *target = yon_dictionary_get_data(dict->first->next,GtkWidget*);
|
|
|
|
|
|
|
|
|
|
int encription_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->EncryptionCombo));
|
|
|
|
|
char *final = NULL;
|
|
|
|
|
if (encription_active == 0||gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){
|
|
|
|
|
final = yon_password_unencrypted_password_get(window);
|
|
|
|
|
if (!final) return;
|
|
|
|
|
} else {
|
|
|
|
|
final = yon_password_hash_get(window);
|
|
|
|
|
if (!final) return;
|
|
|
|
|
}
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(target),final);
|
|
|
|
|
gtk_widget_destroy(window->Window);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|