Password changes

pull/106/head
parent 269e51676b
commit b4b419435c

@ -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,56 +1380,55 @@ 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*);
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){
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;
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)){
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->PasswordHashEntry);
return;
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
return NULL;
}
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;
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 *final = yon_char_unite(encription,"|",hash,NULL);
gtk_entry_set_text(GTK_ENTRY(target),final);
free(final);
}
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));
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;
}
int size;
@ -1428,10 +1436,25 @@ void on_password_accept(GtkWidget *,dictionary *dict){
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);
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);
}

@ -380,4 +380,7 @@ void on_repo_source_add(GtkWidget *, repo_add_window *window);
void on_cell_renderer_toggle_toggled(GtkWidget *self, gchar* path, GtkWidget *table);
void on_mirror_configure_accept(GtkWidget *, dictionary *dict);
char *yon_password_unencrypted_password_get(password_window *window);
char *yon_password_hash_get(password_window *window);
void yon_hash_entry_sensitiveness_update(GtkWidget *, password_window *dialog);
#endif

@ -31,6 +31,8 @@ Configuration - configuration path")
#define MIRROR_TOOLTIP_LABEL _("url - web-link for repository. It is allowed to write multiple, separating with comma (,)\n\
http_proxy - proxy-server for repository, replaces 'http_proxy'. Single parameter per repository\n\
mirrorlist - mirrors file, make sure server URL is NOT included in this file! Single parameter per repository")
#define PASSWORD_INPUT_LABEL _("Password input")
/*
#define _LABEL _("Signature verification will not be performed")
#define _LABEL _("Signatures will be verified if present, but unsigned databases and packages will also be accepted")
@ -153,7 +155,6 @@ mirrorlist - mirrors file, make sure server URL is NOT included in this file! Si
#define _LABEL _("Months")
#define _LABEL _("Sign level")
#define _LABEL _("Description")
#define _LABEL _("Password input")
#define _LABEL _("Password:")
#define _LABEL _("Repeat password:")
#define _LABEL _("Entryption:")

Loading…
Cancel
Save