summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Borges <felipeborges@gnome.org>2021-02-22 17:00:29 +0100
committerFelipe Borges <felipeborges@gnome.org>2021-02-23 11:08:09 +0100
commit1b770ef65c11b85934842cd34d98212488b5b73f (patch)
treebb372da0bc76fac52025f7bf9bfab9bc070579db
parente77d1a75d894ab5c7a666cdd3fac2dca6d7b4e04 (diff)
downloadgnome-control-center-wifi-hotspot-psw-max-chars.tar.gz
network: Indicate the maximum password length accepted for wifi hotspotswifi-hotspot-psw-max-chars
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.
-rw-r--r--panels/network/cc-wifi-hotspot-dialog.c11
1 files changed, 10 insertions, 1 deletions
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));
}