[gnome-control-center/wifi-hotspot-psw-max-chars: 87/87] network: Indicate the maximum password length accepted for wifi hotspots




commit afe1c35c57d391984cfb3a530c8c56d439542d91
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Feb 22 17:00:29 2021 +0100

    network: Indicate the maximum password length accepted for wifi hotspots
    
    The Wifi Hotspot setup dialog will error "Must have a minimum of 8 characters"
    for all the situations in which nm_utils_wpa_psk_valid and nm_utils_wep_key_valid
    report a given password to be invalid.
    
    The case when this error is most obvious is when you enter a very lengthy password
    and the dialog shows the very same error about the minimum password length.
    
    These changes make the dialog account for the Maximum password length as well. It
    assumes 16 characters for WEP and 63 characters for WPA/WPA2.

 panels/network/cc-wifi-hotspot-dialog.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/panels/network/cc-wifi-hotspot-dialog.c b/panels/network/cc-wifi-hotspot-dialog.c
index 4d1ef2478..ece2091a3 100644
--- a/panels/network/cc-wifi-hotspot-dialog.c
+++ b/panels/network/cc-wifi-hotspot-dialog.c
@@ -262,7 +262,16 @@ hotspot_entry_changed_cb (CcWifiHotspotDialog *self)
     }
   else
     {
-      error_label = _("Must have a minimum of 8 characters");
+      if (strlen (password) < 8)
+        {
+          error_label = _("Must have a minimum of 8 characters");
+        }
+      else
+        {
+          guint max_chars = self->wpa_supported ? 63 : 16;
+          error_label = g_strdup_printf (_("Must have a maximum of %d characters"), max_chars);
+        }
+
       widget_set_error (GTK_WIDGET(self->password_entry));
     }
 


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