[network-manager-openvpn/th/cleanup: 10/11] properties: don't require username in GUI



commit b51435e0b4cb980352eefc1fc86ff4ca85070830
Author: Thomas Haller <thaller redhat com>
Date:   Fri Nov 17 16:24:33 2017 +0100

    properties: don't require username in GUI
    
    The connection is perfectly valid without the "username" key.
    Note that the VPN settings support a data setting
    NM_OPENVPN_KEY_USERNAME ("username"), but NMSettingVpn also has a
    NM_SETTING_VPN_USER_NAME ("user-name") setting.
    
    So, NM_OPENVPN_KEY_USERNAME has preference over
    NM_SETTING_VPN_USER_NAME. But even if the username is entirely missing
    in the setting, NetworkManager will populate it with the user-name
    of the user activating the connection.
    
    It is wrong to require a user name in the GUI.

 properties/nm-openvpn-dialog.ui |    4 ++--
 properties/nm-openvpn-editor.c  |   19 -------------------
 2 files changed, 2 insertions(+), 21 deletions(-)
---
diff --git a/properties/nm-openvpn-dialog.ui b/properties/nm-openvpn-dialog.ui
index 86ff00e..9d4a271 100644
--- a/properties/nm-openvpn-dialog.ui
+++ b/properties/nm-openvpn-dialog.ui
@@ -338,7 +338,7 @@ config: auth-user-pass</property>
                               <object class="GtkEntry" id="pw_username_entry">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="tooltip_text" translatable="yes">Username passed to OpenVPN 
when prompted for it.
+                                <property name="tooltip_text" translatable="yes">Username passed to OpenVPN 
when prompted for it. If omitted, use the name of the system user that activates the connection.
 config: auth-user-pass</property>
                                 <property name="hexpand">True</property>
                               </object>
@@ -440,7 +440,7 @@ config: auth-user-pass</property>
                               <object class="GtkEntry" id="pw_tls_username_entry">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="tooltip_text" translatable="yes">Username passed to OpenVPN 
when prompted for it.
+                                <property name="tooltip_text" translatable="yes">Username passed to OpenVPN 
when prompted for it. If omitted, use the name of the system user that activates the connection.
 config: auth-user-pass</property>
                                 <property name="hexpand">True</property>
                               </object>
diff --git a/properties/nm-openvpn-editor.c b/properties/nm-openvpn-editor.c
index 4352ff6..a0024e3 100644
--- a/properties/nm-openvpn-editor.c
+++ b/properties/nm-openvpn-editor.c
@@ -411,16 +411,6 @@ auth_widget_check_validity (GtkBuilder *builder, const char *contype, GError **e
        } else if (!strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) {
                if (!validate_tls (builder, "pw_tls", error))
                        return FALSE;
-
-               widget = GTK_WIDGET (gtk_builder_get_object (builder, "pw_tls_username_entry"));
-               str = gtk_entry_get_text (GTK_ENTRY (widget));
-               if (!str || !*str) {
-                       g_set_error (error,
-                                    NMV_EDITOR_PLUGIN_ERROR,
-                                    NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,
-                                    NM_OPENVPN_KEY_USERNAME);
-                       return FALSE;
-               }
        } else if (!strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD)) {
                if (!validate_cert_chooser (builder, "pw_ca_cert", &local)) {
                        g_set_error (error,
@@ -430,15 +420,6 @@ auth_widget_check_validity (GtkBuilder *builder, const char *contype, GError **e
                        g_error_free (local);
                        return FALSE;
                }
-               widget = GTK_WIDGET (gtk_builder_get_object (builder, "pw_username_entry"));
-               str = gtk_entry_get_text (GTK_ENTRY (widget));
-               if (!str || !*str) {
-                       g_set_error (error,
-                                    NMV_EDITOR_PLUGIN_ERROR,
-                                    NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,
-                                    NM_OPENVPN_KEY_USERNAME);
-                       return FALSE;
-               }
        } else if (!strcmp (contype, NM_OPENVPN_CONTYPE_STATIC_KEY)) {
                widget = GTK_WIDGET (gtk_builder_get_object (builder, "sk_key_chooser"));
                filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]