Fixed default user's restrictions

pull/242/head
parent 13509468ce
commit 60b769d44b

@ -390,6 +390,8 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
window->GroupMinCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"GroupMinCell"));
window->GroupMaxCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"GroupMaxCell"));
yon_gtk_login_block_symbols(GTK_ENTRY(window->DefaultUserNameEntry));
yon_gtk_revealer_set_from_expander(GTK_REVEALER(window->UserShutdownRevealer),GTK_EXPANDER(window->UsersShutdownExpander));
yon_gtk_revealer_set_from_expander(GTK_REVEALER(window->GroupShutdownRevealer),GTK_EXPANDER(window->GroupsShutdownExpander));

@ -1,5 +1,33 @@
#include "ubl-settings-usergroups.h"
void on_login_insert_custom_restricted_check(GtkEditable *editable, const gchar *text, gint length, gint *position){
gchar *new_text = g_new(gchar, length + 1);
memset(new_text,0,length+1);
gint i, j = 0;
for (i = 0; i < length; i++) {
if ((text[i]>='a'&&text[i]<='z')||(text[i]>='0'&&text[i]<='9')||strchr("_-",text[i])) {
new_text[j] = text[i];
j++;
}
}
if (j < length) {
g_signal_handlers_block_by_func(editable, G_CALLBACK(on_login_insert_custom_restricted_check), NULL);
gtk_editable_insert_text(editable, new_text, j, position);
g_signal_handlers_unblock_by_func(editable, G_CALLBACK(on_login_insert_custom_restricted_check), NULL);
g_signal_stop_emission_by_name(editable, "insert-text");
}
g_free(new_text);
}
void yon_gtk_login_block_symbols(GtkEntry *target){
g_return_if_fail(GTK_IS_ENTRY(target));
g_signal_connect(G_OBJECT(target),"insert-text",G_CALLBACK(on_login_insert_custom_restricted_check),NULL);
}
void on_parameter_changed(GtkWidget *,ubl_settings_usergroups_user_window *window){
char *user_shell=NULL;
char *user_home=NULL;
@ -130,6 +158,7 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
window->MainNotebook=yon_gtk_builder_get_widget(builder,"MainNotebook");
window->expiration_unix=NULL;
window->last_uid=NULL;
yon_gtk_entry_block_symbols(GTK_ENTRY(window->userUserNameEntry),":");
time_t t = time(NULL);
struct tm tm = *localtime(&t);

@ -562,4 +562,6 @@ void on_additional_settings_cell_toggled(GtkCellRenderer *self, char *path, ubl_
void on_additional_settings_cell_edited(GtkCellRenderer *self, char *path, char *new_text, ubl_settings_usergroups_additional_settings_window *window);
void on_adiitional_settings_tree_selection_changed(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window);
void on_useradd_sync_changed(ubl_settings_usergroups_additional_settings_window *window);
void yon_gtk_login_block_symbols(GtkEntry *target);
void on_login_insert_custom_restricted_check(GtkEditable *editable, const gchar *text, gint length, gint *position);
#endif

@ -76,8 +76,8 @@
<row>
<col id="0">False</col>
<col id="1" translatable="yes">Group GID range</col>
<col id="2" translatable="yes"></col>
<col id="3" translatable="yes"></col>
<col id="2" translatable="yes"/>
<col id="3" translatable="yes"/>
<col id="4">True</col>
<col id="5">True</col>
<col id="6">False</col>
@ -90,8 +90,8 @@
<row>
<col id="0">False</col>
<col id="1" translatable="yes">Group GID in system</col>
<col id="2" translatable="yes"></col>
<col id="3" translatable="yes"></col>
<col id="2" translatable="yes"/>
<col id="3" translatable="yes"/>
<col id="4">True</col>
<col id="5">True</col>
<col id="6">False</col>
@ -176,8 +176,8 @@
<row>
<col id="0">False</col>
<col id="1" translatable="yes">Users UID range</col>
<col id="2" translatable="yes"></col>
<col id="3" translatable="yes"></col>
<col id="2" translatable="yes"/>
<col id="3" translatable="yes"/>
<col id="4">True</col>
<col id="5">True</col>
<col id="6">False</col>
@ -190,8 +190,8 @@
<row>
<col id="0">False</col>
<col id="1" translatable="yes">User UID in system</col>
<col id="2" translatable="yes"></col>
<col id="3" translatable="yes"></col>
<col id="2" translatable="yes"/>
<col id="3" translatable="yes"/>
<col id="4">True</col>
<col id="5">True</col>
<col id="6">False</col>
@ -321,6 +321,7 @@
<object class="GtkEntry" id="DefaultUserNameEntry">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="max-length">32</property>
<property name="placeholder-text" translatable="yes">superadmin</property>
</object>
<packing>

Loading…
Cancel
Save