network: Accept empty passwords if it is not saved
In that case, NM will use gnome-shell to prompt for the password. As such, the form should validate no matter what password is set.
This commit is contained in:
parent
e8df86411b
commit
1decf825c1
6 changed files with 40 additions and 0 deletions
|
@ -55,6 +55,7 @@ static gboolean
|
||||||
validate (EAPMethod *parent, GError **error)
|
validate (EAPMethod *parent, GError **error)
|
||||||
{
|
{
|
||||||
EAPMethodLEAP *self = (EAPMethodLEAP *)parent;
|
EAPMethodLEAP *self = (EAPMethodLEAP *)parent;
|
||||||
|
NMSettingSecretFlags secret_flags;
|
||||||
const char *text;
|
const char *text;
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
|
@ -66,6 +67,12 @@ validate (EAPMethod *parent, GError **error)
|
||||||
} else
|
} else
|
||||||
widget_unset_error (GTK_WIDGET (self->username_entry));
|
widget_unset_error (GTK_WIDGET (self->username_entry));
|
||||||
|
|
||||||
|
secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->password_entry));
|
||||||
|
if (secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED) {
|
||||||
|
widget_unset_error (GTK_WIDGET (self->password_entry));
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
text = gtk_entry_get_text (self->password_entry);
|
text = gtk_entry_get_text (self->password_entry);
|
||||||
if (!text || !strlen (text)) {
|
if (!text || !strlen (text)) {
|
||||||
widget_set_error (GTK_WIDGET (self->password_entry));
|
widget_set_error (GTK_WIDGET (self->password_entry));
|
||||||
|
|
|
@ -79,6 +79,7 @@ validate (EAPMethod *method, GError **error)
|
||||||
{
|
{
|
||||||
EAPMethodTLS *self = EAP_METHOD_TLS (method);
|
EAPMethodTLS *self = EAP_METHOD_TLS (method);
|
||||||
NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
|
NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
|
||||||
|
NMSettingSecretFlags secret_flags;
|
||||||
const char *password, *identity;
|
const char *password, *identity;
|
||||||
g_autoptr(GError) ca_cert_error = NULL;
|
g_autoptr(GError) ca_cert_error = NULL;
|
||||||
g_autoptr(GError) private_key_error = NULL;
|
g_autoptr(GError) private_key_error = NULL;
|
||||||
|
@ -115,6 +116,9 @@ validate (EAPMethod *method, GError **error)
|
||||||
}
|
}
|
||||||
|
|
||||||
password = gtk_entry_get_text (self->private_key_password_entry);
|
password = gtk_entry_get_text (self->private_key_password_entry);
|
||||||
|
secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->private_key_password_entry));
|
||||||
|
if (secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED)
|
||||||
|
password = NULL;
|
||||||
|
|
||||||
if (!eap_method_validate_filepicker (GTK_FILE_CHOOSER (self->private_key_button),
|
if (!eap_method_validate_filepicker (GTK_FILE_CHOOSER (self->private_key_button),
|
||||||
TYPE_PRIVATE_KEY,
|
TYPE_PRIVATE_KEY,
|
||||||
|
|
|
@ -56,6 +56,7 @@ static gboolean
|
||||||
validate (WirelessSecurity *security, GError **error)
|
validate (WirelessSecurity *security, GError **error)
|
||||||
{
|
{
|
||||||
WirelessSecurityLEAP *self = WS_LEAP (security);
|
WirelessSecurityLEAP *self = WS_LEAP (security);
|
||||||
|
NMSettingSecretFlags secret_flags;
|
||||||
const char *text;
|
const char *text;
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
|
@ -67,6 +68,12 @@ validate (WirelessSecurity *security, GError **error)
|
||||||
} else
|
} else
|
||||||
widget_unset_error (GTK_WIDGET (self->username_entry));
|
widget_unset_error (GTK_WIDGET (self->username_entry));
|
||||||
|
|
||||||
|
secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->password_entry));
|
||||||
|
if (secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED) {
|
||||||
|
widget_unset_error (GTK_WIDGET (self->password_entry));
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
text = gtk_entry_get_text (self->password_entry);
|
text = gtk_entry_get_text (self->password_entry);
|
||||||
if (!text || !strlen (text)) {
|
if (!text || !strlen (text)) {
|
||||||
widget_set_error (GTK_WIDGET (self->password_entry));
|
widget_set_error (GTK_WIDGET (self->password_entry));
|
||||||
|
|
|
@ -59,8 +59,16 @@ static gboolean
|
||||||
validate (WirelessSecurity *security, GError **error)
|
validate (WirelessSecurity *security, GError **error)
|
||||||
{
|
{
|
||||||
WirelessSecuritySAE *self = WS_SAE (security);
|
WirelessSecuritySAE *self = WS_SAE (security);
|
||||||
|
NMSettingSecretFlags secret_flags;
|
||||||
const char *key;
|
const char *key;
|
||||||
|
|
||||||
|
secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->password_entry));
|
||||||
|
if (secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED)
|
||||||
|
{
|
||||||
|
widget_unset_error (GTK_WIDGET (self->password_entry));
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
key = gtk_entry_get_text (self->password_entry);
|
key = gtk_entry_get_text (self->password_entry);
|
||||||
|
|
||||||
if (key == NULL || key[0] == '\0')
|
if (key == NULL || key[0] == '\0')
|
||||||
|
|
|
@ -98,9 +98,16 @@ static gboolean
|
||||||
validate (WirelessSecurity *security, GError **error)
|
validate (WirelessSecurity *security, GError **error)
|
||||||
{
|
{
|
||||||
WirelessSecurityWEPKey *self = WS_WEP_KEY (security);
|
WirelessSecurityWEPKey *self = WS_WEP_KEY (security);
|
||||||
|
NMSettingSecretFlags secret_flags;
|
||||||
const char *key;
|
const char *key;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->key_entry));
|
||||||
|
if (secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED) {
|
||||||
|
widget_unset_error (GTK_WIDGET (self->key_entry));
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
key = gtk_entry_get_text (self->key_entry);
|
key = gtk_entry_get_text (self->key_entry);
|
||||||
if (!key) {
|
if (!key) {
|
||||||
widget_set_error (GTK_WIDGET (self->key_entry));
|
widget_set_error (GTK_WIDGET (self->key_entry));
|
||||||
|
|
|
@ -59,10 +59,17 @@ static gboolean
|
||||||
validate (WirelessSecurity *security, GError **error)
|
validate (WirelessSecurity *security, GError **error)
|
||||||
{
|
{
|
||||||
WirelessSecurityWPAPSK *self = WS_WPA_PSK (security);
|
WirelessSecurityWPAPSK *self = WS_WPA_PSK (security);
|
||||||
|
NMSettingSecretFlags secret_flags;
|
||||||
const char *key;
|
const char *key;
|
||||||
gsize len;
|
gsize len;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->password_entry));
|
||||||
|
if (secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED) {
|
||||||
|
widget_unset_error (GTK_WIDGET (self->password_entry));
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
key = gtk_entry_get_text (self->password_entry);
|
key = gtk_entry_get_text (self->password_entry);
|
||||||
len = key ? strlen (key) : 0;
|
len = key ? strlen (key) : 0;
|
||||||
if ((len < 8) || (len > 64)) {
|
if ((len < 8) || (len > 64)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue