Added password language check #140

Merged
asmeron merged 4 commits from YanTheKaller/ubl-settings-repomanager:master into master 2 weeks ago

@ -582,3 +582,7 @@ msgstr ""
#: source/ubl-strings.h:183
msgid "Repository were not added"
msgstr ""
#: source/ubl-strings.h:183
msgid "Invalid password"
msgstr ""

@ -596,3 +596,7 @@ msgstr "Выбранный каталог хранилища находится
#: source/ubl-strings.h:183
msgid "Repository were not added"
msgstr "Репозиторий не добавлен"
#: source/ubl-strings.h:183
msgid "Invalid password"
msgstr "Неверный пароль"

@ -47,21 +47,27 @@ void on_key_generate_accept(GtkWidget *self, key_creation_window* window){
const char *password_confirm = gtk_entry_get_text(GTK_ENTRY(window->PasswordConfirmationEntry));
int ex_status=0;
if (yon_char_is_empty(password)&&yon_char_is_empty(password_confirm)){
yon_debug_output("%s\n",yon_generate_key_no_password_command(type,name,email,strength,comment,expire,password));
ex_status = system(yon_debug_output("%s\n",yon_generate_key_no_password_command(type,name,email,strength,comment,expire,password)));
char *command = yon_generate_key_no_password_command(type,name,email,strength,comment,expire,password);
yon_debug_output("%s\n",command);
yon_terminal_window_launch_shell(GTK_WINDOW(window->Window),(yon_debug_output("%s\n",command)),yon_char_get_localised_from_lib(SUCCESS_LABEL),yon_char_get_localised_from_lib(FAIL_LABEL));
} else if (!strcmp(password,password_confirm)){
yon_debug_output("%s\n",yon_generate_key_command(type,name,email,strength,comment,expire,password));
ex_status = system(yon_debug_output("%s\n",yon_generate_key_command(type,name,email,strength,comment,expire,password)));
for (int i=0;i<strlen(password);i++){
if (!g_ascii_isgraph(password[i])){
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_INVALID_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
return;
}
}
char *command = yon_generate_key_command(type,name,email,strength,comment,expire,password);
yon_debug_output("%s\n",command);
yon_terminal_window_launch_shell(GTK_WINDOW(window->Window),yon_debug_output("%s\n",command),yon_char_get_localised_from_lib(SUCCESS_LABEL),yon_char_get_localised_from_lib(FAIL_LABEL));
} else {
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_INCORRECT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(window->PasswordConfirmationEntry);
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
return;
}
if (!ex_status)
yon_ubl_status_box_render(KEY_CREATION_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
else
yon_ubl_status_box_render(KEY_CREATION_FAILURE_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
gtk_widget_destroy(window->Window);
yon_sign_list_update();
}

@ -119,14 +119,14 @@ Key-Type: ",type,"\n\
Key-Length: 1024\n\
Subkey-Type: ELG-E\n\
Subkey-Length: ",strength,"\n\
Name-Real: ",name,"\n",\
!yon_char_is_empty(comment)?"Name-Comment: ":"",!yon_char_is_empty(comment)?comment:"",!yon_char_is_empty(comment)?"\n":""\
"Name-Email: ",email,"\n\
Name-Real: '",name,"'\n",\
!yon_char_is_empty(comment)?"Name-Comment: ":"",!yon_char_is_empty(comment)?comment:"",!yon_char_is_empty(comment)?"\n":"","\
Name-Email: '",email,"'\n\
Expire-Date: ",!yon_char_is_empty(expire)?expire:"0","\n\
Passphrase: ",password,"\n\
Passphrase: '",password,"'\n\
%commit\n\
%echo done\n\
EOF",NULL)
EOF\n\n",NULL)
#define yon_generate_key_no_password_command(type,name,email,strength,comment,expire,password) yon_char_unite("gpg --batch --gen-key <<EOF\n\
%echo Generating a basic OpenPGP key\n\
@ -135,13 +135,13 @@ Key-Length: 1024\n\
Subkey-Type: ELG-E\n\
Subkey-Length: ",strength,"\n\
Name-Real: ",name,"\n",\
!yon_char_is_empty(comment)?"Name-Comment: ":"",!yon_char_is_empty(comment)?comment:"",!yon_char_is_empty(comment)?"\n":""\
"Name-Email: ",email,"\n\
!yon_char_is_empty(comment)?"Name-Comment: ":"",!yon_char_is_empty(comment)?comment:"",!yon_char_is_empty(comment)?"\n":"","\
Name-Email: '",email,"'\n\
Expire-Date: ",!yon_char_is_empty(expire)?expire:"0","\n\
%no-protection\n\
%commit\n\
%echo done\n\
EOF",NULL)
EOF\n\n",NULL)
#define STORAGE_search_macro "STORAGE["
#define STORAGE(target) yon_char_unite("STORAGE[",target,"]",NULL)

@ -182,4 +182,6 @@
#define INSIDE_STORAGE_ERROR_LABEL _("Chosen storage directory is inside of another storage")
#define UNADDED_REPO_LABEL _("Repository were not added")
#define UNADDED_REPO_LABEL _("Repository were not added")
#define PASSWORD_INVALID_LABEL _("Invalid password")

@ -345,6 +345,7 @@
<object class="GtkEntry" id="PasswordEntry">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="max-length">128</property>
<property name="visibility">False</property>
<property name="invisible-char">*</property>
</object>
@ -383,6 +384,7 @@
<object class="GtkEntry" id="PasswordConfirmationEntry">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="max-length">128</property>
<property name="visibility">False</property>
<property name="invisible-char">*</property>
</object>

Loading…
Cancel
Save