|
|
|
|
@ -63,7 +63,7 @@ void on_password_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
|
ubl_settings_usergroups_password_window *window = yon_dictionary_get_data(dict->first,ubl_settings_usergroups_password_window*);
|
|
|
|
|
GtkEntry *entry = yon_dictionary_get_data(dict->first->next,GtkEntry*);
|
|
|
|
|
char *password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
char *password_check = (char*)gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry));
|
|
|
|
|
char *password_check = (char*)gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry));
|
|
|
|
|
if (yon_char_is_empty(password)){
|
|
|
|
|
char *pasted_hash = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry));
|
|
|
|
|
if (!yon_char_is_empty(pasted_hash)){
|
|
|
|
|
@ -95,10 +95,39 @@ void on_password_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_MISMATCH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
pwquality_settings_t *settings = pwquality_default_settings();
|
|
|
|
|
int password_strength = pwquality_check(settings,password,NULL,NULL,NULL);
|
|
|
|
|
if (password_strength<30){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),WEAK_PASSWORD_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_changed(GtkWidget *, ubl_settings_usergroups_password_window *window){
|
|
|
|
|
pwquality_settings_t *settings = pwquality_default_settings();
|
|
|
|
|
const char *new_password = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
int password_strength = pwquality_check(settings,new_password,NULL,NULL,NULL);
|
|
|
|
|
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(window->PasswordStrengthProgress),(gdouble)password_strength/100);
|
|
|
|
|
if (password_strength<30){
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(window->PasswordStrengthProgress),"redBox");
|
|
|
|
|
gtk_style_context_remove_class(gtk_widget_get_style_context(window->PasswordStrengthProgress),"greenBox");
|
|
|
|
|
gtk_style_context_remove_class(gtk_widget_get_style_context(window->PasswordStrengthProgress),"yellowBox");
|
|
|
|
|
} else if (password_strength<60) {
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(window->PasswordStrengthProgress),"yellowBox");
|
|
|
|
|
gtk_style_context_remove_class(gtk_widget_get_style_context(window->PasswordStrengthProgress),"redBox");
|
|
|
|
|
gtk_style_context_remove_class(gtk_widget_get_style_context(window->PasswordStrengthProgress),"greenBox");
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(window->PasswordStrengthProgress),"greenBox");
|
|
|
|
|
gtk_style_context_remove_class(gtk_widget_get_style_context(window->PasswordStrengthProgress),"redBox");
|
|
|
|
|
gtk_style_context_remove_class(gtk_widget_get_style_context(window->PasswordStrengthProgress),"yellowBox");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_hash_sensitiveness(GtkWidget *,ubl_settings_usergroups_password_window *window){
|
|
|
|
|
if (!yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)))||!yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry)))){
|
|
|
|
|
gtk_widget_set_sensitive(window->HashBox,0);
|
|
|
|
|
@ -123,6 +152,7 @@ ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_ne
|
|
|
|
|
window->HashBox=yon_gtk_builder_get_widget(builder,"HashBox");
|
|
|
|
|
window->PasswordBox=yon_gtk_builder_get_widget(builder,"PasswordBox");
|
|
|
|
|
window->NoEncriptionCheck=yon_gtk_builder_get_widget(builder,"NoEncriptionCheck");
|
|
|
|
|
window->PasswordStrengthProgress=yon_gtk_builder_get_widget(builder,"PasswordStrengthProgress");
|
|
|
|
|
|
|
|
|
|
window->UserCancelButton=yon_gtk_builder_get_widget(builder,"UserCancelButton");
|
|
|
|
|
window->UserOkButton=yon_gtk_builder_get_widget(builder,"UserOkButton");
|
|
|
|
|
@ -130,6 +160,7 @@ ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_ne
|
|
|
|
|
yon_window_config_custom_window_setup(GTK_WINDOW(window->CreateGroupWindow),"PasswordWindow");
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordEntry),"changed",G_CALLBACK(on_password_changed),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);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordHashEntry),"changed",G_CALLBACK(on_password_hash_sensitiveness),window);
|
|
|
|
|
|