|
|
|
|
@ -1426,11 +1426,26 @@ char *yon_password_hash_get(password_window *window){
|
|
|
|
|
const char *encription = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->EncryptionCombo));
|
|
|
|
|
const char *hash = gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry));
|
|
|
|
|
if (!yon_char_is_empty(hash)){
|
|
|
|
|
if (!yon_char_is_empty(window->old_password)&&strcmp(hash,window->old_password)&&strlen(hash)!=128&&strlen(hash)!=64){
|
|
|
|
|
// if (!yon_char_is_empty(window->old_password)&&strcmp(hash,window->old_password)){
|
|
|
|
|
switch(encription_active){
|
|
|
|
|
case 1:{
|
|
|
|
|
if (strlen(hash)!=128){
|
|
|
|
|
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 NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 2:{
|
|
|
|
|
if (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 NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
char *final = yon_char_unite(encription,"|",hash,NULL);
|
|
|
|
|
return final;
|
|
|
|
|
} else {
|
|
|
|
|
@ -1601,6 +1616,29 @@ void on_file_chooser_open(GtkWidget *, GtkEntry *target){
|
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_hash_sensitiveness(GtkWidget *,password_window *window){
|
|
|
|
|
const char *password = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
const char *repeat_password = gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry));
|
|
|
|
|
const char *hash = gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry));
|
|
|
|
|
if (!yon_char_is_empty(password)||!yon_char_is_empty(repeat_password)){
|
|
|
|
|
gtk_widget_set_sensitive(window->HashBox,0);
|
|
|
|
|
gtk_widget_set_sensitive(window->PasswordBox,1);
|
|
|
|
|
} else if (yon_char_is_empty(password)&&yon_char_is_empty(repeat_password)&&
|
|
|
|
|
gtk_combo_box_get_active(GTK_COMBO_BOX(window->EncryptionCombo))>0&&
|
|
|
|
|
yon_char_is_empty(hash)){
|
|
|
|
|
gtk_widget_set_sensitive(window->HashBox,1);
|
|
|
|
|
gtk_widget_set_sensitive(window->PasswordBox,1);
|
|
|
|
|
gtk_widget_set_sensitive(window->NoEncriptionCheck,1);
|
|
|
|
|
} else if (!yon_char_is_empty(hash)) {
|
|
|
|
|
gtk_widget_set_sensitive(window->HashBox,1);
|
|
|
|
|
gtk_widget_set_sensitive(window->PasswordBox,0);
|
|
|
|
|
gtk_widget_set_sensitive(window->NoEncriptionCheck,0);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_set_sensitive(window->HashBox,0);
|
|
|
|
|
gtk_widget_set_sensitive(window->PasswordBox,1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
password_window *yon_password_window_new(){
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_password_path);
|
|
|
|
|
password_window *window = malloc(sizeof(password_window));
|
|
|
|
|
@ -1614,10 +1652,16 @@ password_window *yon_password_window_new(){
|
|
|
|
|
window->PasswordHashEntry = yon_gtk_builder_get_widget(builder,"PasswordHashEntry");
|
|
|
|
|
window->UserCancelButton = yon_gtk_builder_get_widget(builder,"UserCancelButton");
|
|
|
|
|
window->AcceptButton = yon_gtk_builder_get_widget(builder,"UserOkButton");
|
|
|
|
|
window->PasswordBox = yon_gtk_builder_get_widget(builder,"PasswordBox");
|
|
|
|
|
window->HashBox = yon_gtk_builder_get_widget(builder,"HashBox");
|
|
|
|
|
|
|
|
|
|
window->old_password=NULL;
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->NoEncriptionCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->PasswordHashEntry);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->EncryptionCombo),"changed",G_CALLBACK(on_password_hash_sensitiveness),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->NoEncriptionCheck),"toggled",G_CALLBACK(on_password_hash_sensitiveness),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordHashEntry),"changed",G_CALLBACK(on_password_hash_sensitiveness),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordEntry),"changed",G_CALLBACK(on_password_hash_sensitiveness),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->RepeatPasswordEntry),"changed",G_CALLBACK(on_password_hash_sensitiveness),window);
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|