nm: Add minimum length constraint for PSK passwords in connection editor

We already have this restriction in the auth-dialog.
This commit is contained in:
Tobias Brunner 2016-04-21 17:46:02 +02:00
parent a238f534e8
commit 2b63883dba
1 changed files with 16 additions and 0 deletions

View File

@ -127,6 +127,22 @@ check_validity (StrongswanPluginUiWidget *self, GError **error)
"address");
return FALSE;
}
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "method-combo"));
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)))
{
case 4:
{
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "passwd-entry"));
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
if (str && strlen (str) < 20) {
g_set_error (error,
STRONGSWAN_PLUGIN_UI_ERROR,
STRONGSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY,
"password is too short");
return FALSE;
}
}
}
return TRUE;
}