diff --git a/Makefile b/Makefile
index 9751fcd..6aa547b 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ DEPENDS = /bin/cmake
PREFIX ?= /usr/local
PKGNAME = $(MAKEFILE_DIR)
FILE_VER = source/CMakeLists.txt
-PKGIDENT=$(subst /,-,${PREFIX})
+PKGIDENT=$(subst /,-,/usr)
default_target: all
@@ -49,14 +49,14 @@ depend:
debug:
@echo "Debug ..."
if [ ! -d ${CMAKE_UI_BUILD_DIR} ]; then \
- $(CMAKE_UI_COMMAND) -S${CMAKE_UI_SOURCE_DIR} -B${CMAKE_UI_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="${PREFIX}"; \
+ $(CMAKE_UI_COMMAND) -S${CMAKE_UI_SOURCE_DIR} -B${CMAKE_UI_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="/usr"; \
fi; \
echo "Debug: OK"
prepare:
@echo "Prepare ..."; \
if [ ! -d ${CMAKE_UI_BUILD_DIR} ]; then \
- $(CMAKE_UI_COMMAND) -DCMAKE_INSTALL_PREFIX=/usr -S${CMAKE_UI_SOURCE_DIR} -B${CMAKE_UI_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}"; \
+ $(CMAKE_UI_COMMAND) -DCMAKE_INSTALL_PREFIX=/usr -S${CMAKE_UI_SOURCE_DIR} -B${CMAKE_UI_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/usr"; \
fi; \
echo "Prepare: OK"
@@ -79,7 +79,7 @@ build: depend prepare
uninstall:
@echo "Uninstall ..."
@for LANG in $$(find ./ -iname "*.po" -print | sed -En "s/.+_([[:alpha:]]+)\.po/\1/p" | sort -u); do \
-# PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/${PKGNAME}.mo"; \
+# PATH_FILE_MO="${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES/${PKGNAME}.mo"; \
PATH_FILE_MO="${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES/${PKGNAME}.mo"; \
$(RM) "$${PATH_FILE_MO}"; \
done
@@ -90,25 +90,25 @@ uninstall:
$(RM) "$${PATH_FILE_MO}"; \
done
@for SIZE in 16x16 32x32 48x48 scalable; do \
- $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \
- $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/apps/com.ublinux.${PKGNAME}.png"; \
+ $(RM) "${DESTDIR}/usr/share/icons/hicolor/$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \
+ $(RM) "${DESTDIR}/usr/share/icons/hicolor/$${SIZE}/apps/com.ublinux.${PKGNAME}.png"; \
done
@for FILE_SVG in $(wildcard *.svg); do \
for SIZE in 16x16 32x32 48x48 scalable; do \
- $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/status/$${FILE_SVG%.*}".{svg,png,jpg}; \
+ $(RM) "${DESTDIR}/usr/share/icons/hicolor/$${SIZE}/status/$${FILE_SVG%.*}".{svg,png,jpg}; \
done; \
done
@for FILE_ICON in $(wildcard icons/*/*.svg); do \
SUB_NAME=$${FILE_ICON#*/};SUB_NAME=$${FILE_ICON%/*}; \
$(RM) "${DESTDIR}/usr/share/icons/hicolor/scalable/$${SUB_NAME}/$${FILE_ICON##*/}"; \
done
- @$(RM) "${DESTDIR}${PREFIX}/lib/${PKGNAME}".so*
- @$(RM) "${DESTDIR}${PREFIX}/include/${PKGNAME}".h*
+ @$(RM) "${DESTDIR}/usr/lib/${PKGNAME}".so*
+ @$(RM) "${DESTDIR}/usr/include/${PKGNAME}".h*
@if [ -z ${DESTDIR} ]; then \
- [ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \
+ [ -d "${DESTDIR}/usr/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}/usr/share/icons/hicolor/" &>/dev/null || true; \
update-desktop-database --quiet &>/dev/null || true; \
- [ -d "${DESTDIR}${PREFIX}/share/applications" ] && touch "${DESTDIR}${PREFIX}/share/applications" &>/dev/null || true; \
- ldconfig -n ${DESTDIR}${PREFIX}/lib; \
+ [ -d "${DESTDIR}/usr/share/applications" ] && touch "${DESTDIR}/usr/share/applications" &>/dev/null || true; \
+ ldconfig -n ${DESTDIR}/usr/lib; \
fi
@echo "Uninstall: OK"
@@ -124,8 +124,8 @@ install: check
msgfmt "$${FILE_PO}" -v -f -o "$${PATH_FILE_MO}"; \
done
@for SIZE in 16 32 48; do \
- install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps"; \
- rsvg-convert -w $${SIZE} -h $${SIZE} -f svg --keep-image-data "com.ublinux.${PKGNAME}.svg" -o "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \
+ install -dm755 "${DESTDIR}/usr/share/icons/hicolor/$${SIZE}x$${SIZE}/apps"; \
+ rsvg-convert -w $${SIZE} -h $${SIZE} -f svg --keep-image-data "com.ublinux.${PKGNAME}.svg" -o "${DESTDIR}/usr/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \
done
@install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg"
@for FILE_ICON in $(wildcard icons/*/*.svg); do \
@@ -136,7 +136,7 @@ install: check
[ -d "${DESTDIR}/usr/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}/usr/share/icons/hicolor/" &>/dev/null || true; \
update-desktop-database --quiet &>/dev/null || true; \
[ -d "${DESTDIR}/usr/share/applications" ] && touch "${DESTDIR}/usr/share/applications" &>/dev/null || true; \
- ldconfig -n ${DESTDIR}${PREFIX}/lib; \
+ ldconfig -n ${DESTDIR}/usr/lib; \
fi
@echo "Install: OK"
diff --git a/libublsettingsui-gtk3-password.glade b/libublsettingsui-gtk3-password.glade
index 81710d0..118c6d4 100644
--- a/libublsettingsui-gtk3-password.glade
+++ b/libublsettingsui-gtk3-password.glade
@@ -145,6 +145,43 @@
0
+
+
+
+ False
+ True
+ 1
+
+
True
@@ -185,7 +222,7 @@
True
True
- 1
+ 2
@@ -200,7 +237,7 @@
False
True
- 2
+ 3
@@ -211,7 +248,7 @@
False
True
- 3
+ 4
@@ -264,7 +301,7 @@
False
True
- 4
+ 5
@@ -328,6 +365,7 @@
+
diff --git a/libublsettingsui-gtk3.pot b/libublsettingsui-gtk3.pot
index f87abcf..7160df8 100644
--- a/libublsettingsui-gtk3.pot
+++ b/libublsettingsui-gtk3.pot
@@ -394,4 +394,7 @@ msgid "The configuration file contains incorrect parameters."
msgstr ""
msgid "Empty important field!"
+msgstr ""
+
+msgid "The password does not meet the password policy requirements!"
msgstr ""
\ No newline at end of file
diff --git a/libublsettingsui-gtk3_ru.po b/libublsettingsui-gtk3_ru.po
index d84a9a9..f676c2d 100644
--- a/libublsettingsui-gtk3_ru.po
+++ b/libublsettingsui-gtk3_ru.po
@@ -400,4 +400,7 @@ msgid "The configuration file contains incorrect parameters."
msgstr "Файл конфигурации содержит некорректные параметры"
msgid "Empty important field!"
-msgstr "Пустое важное поле!"
\ No newline at end of file
+msgstr "Пустое важное поле!"
+
+msgid "The password does not meet the password policy requirements!"
+msgstr "Пароль не соответствует требованиям политики паролей"
\ No newline at end of file
diff --git a/source/libublsettingsui-gtk3-password.c b/source/libublsettingsui-gtk3-password.c
index 6b6ce7a..57dcfa4 100644
--- a/source/libublsettingsui-gtk3-password.c
+++ b/source/libublsettingsui-gtk3-password.c
@@ -1,6 +1,5 @@
#include "libublsettingsui-gtk3.h"
-
#define sha256_encrypt_command(target) yon_char_unite("echo -n \"",target,"\" | sha256sum | cut -f 1 -d ' '",NULL)
#define sha512_encrypt_command(target) yon_char_unite("echo -n \"",target,"\" | sha512sum | cut -f 1 -d ' '",NULL)
@@ -112,10 +111,15 @@ void yon_hash_entry_sensitiveness_update(GtkWidget *, yon_password_window *dialo
void yon_password_hash_list_set(yon_password_window *window, config_str hashes, config_str get_hash_commands, int size){
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(window->EncryptionCombo));
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->EncryptionCombo),_ENCRYPTION_DEFAULT_LABEL,"");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->EncryptionCombo),"",_ENCRYPTION_DEFAULT_LABEL);
+ if (!size){
+ gtk_widget_hide(gtk_widget_get_parent(window->EncryptionCombo));
+ gtk_widget_hide(window->NoEncriptionCheck);
+ gtk_widget_hide(window->HashBox);
+ }
for (int i=0;iEncryptionCombo),hashes[i],get_hash_commands[i]);
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->EncryptionCombo),get_hash_commands[i],hashes[i]);
}
}
@@ -149,6 +153,10 @@ void on_password_hash_sensitiveness(GtkWidget *,yon_password_window *window){
}
}
+void yon_password_function_set(yon_password_window *window, double *password_func){
+ window->strength_func = password_func;
+}
+
void on_password_accept(GtkWidget *,dictionary *dict){
yon_password_window *window = yon_dictionary_get_data(dict->first,yon_password_window*);
GtkWidget *target = yon_dictionary_get_data(dict->first->next,GtkWidget*);
@@ -157,6 +165,14 @@ void on_password_accept(GtkWidget *,dictionary *dict){
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 (window->strength_func){
+ double password_strength = ((double(*)(yon_password_window *,const char*))window->strength_func)(window,final);
+ if (password_strength<0.3){
+ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),WEAK_PASSWORD_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
+ return;
+ }
+ }
if (!final) return;
} else {
final = yon_password_hash_get(window);
@@ -166,6 +182,11 @@ void on_password_accept(GtkWidget *,dictionary *dict){
gtk_widget_destroy(window->Window);
}
+void on_password_changed(GtkWidget *, yon_password_window *window){
+ const char *password_str = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
+ double strength = ((double(*)(yon_password_window *,const char*))window->strength_func)(window,password_str);
+}
+
yon_password_window *yon_password_window_new(){
GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_password);
yon_password_window *window = malloc(sizeof(yon_password_window));
@@ -177,6 +198,7 @@ yon_password_window *yon_password_window_new(){
window->EncryptionCombo = yon_gtk_builder_get_widget(builder,"EncryptionCombo");
window->NoEncriptionCheck = yon_gtk_builder_get_widget(builder,"NoEncriptionCheck");
window->PasswordHashEntry = yon_gtk_builder_get_widget(builder,"PasswordHashEntry");
+ window->PasswordStrengthProgress= yon_gtk_builder_get_widget(builder,"PasswordStrengthProgress");
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");
@@ -188,6 +210,7 @@ yon_password_window *yon_password_window_new(){
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->PasswordEntry),"changed",G_CALLBACK(on_password_changed),window);
g_signal_connect(G_OBJECT(window->RepeatPasswordEntry),"changed",G_CALLBACK(on_password_hash_sensitiveness),window);
gtk_widget_show(window->Window);
return window;
diff --git a/source/libublsettingsui-gtk3.h b/source/libublsettingsui-gtk3.h
index c40ebec..b889fad 100644
--- a/source/libublsettingsui-gtk3.h
+++ b/source/libublsettingsui-gtk3.h
@@ -556,7 +556,11 @@ typedef struct {
GtkWidget *PasswordBox;
GtkWidget *HashBox;
+ GtkWidget *PasswordStrengthProgress;
+
+ void *strength_func;
const char *old_password;
+
} yon_password_window;
@@ -570,6 +574,7 @@ GtkWidget *yon_config_save_window_new();
void yon_password_hash_list_set(yon_password_window *window, config_str hashes, config_str get_hash_commands, int size);
yon_password_window *yon_password_open(GtkEntry *target);
+void yon_password_function_set(yon_password_window *window, double *password_func);
typedef struct {
GtkWidget *Window;
@@ -720,4 +725,5 @@ yon_window *yon_window_new();
#define DMY_MINUS_FORMAT_LABEL _("DD-MM-YYYY")
#define DMY_SLASH_FORMAT_LABEL _("DD/MM/YYYY")
#define MDY_FORMAT_LABEL _("MM-DD-YYYY")
+ #define WEAK_PASSWORD_LABEL _("The password does not meet the password policy requirements")
#endif
\ No newline at end of file