summaryrefslogtreecommitdiff
path: root/panels
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2018-04-11 10:01:20 +0200
committerOndrej Holy <oholy@redhat.com>2018-07-11 10:38:57 +0200
commitd07a67fcb3c6c778d3df621d9643712b89410442 (patch)
treea8fcabef56bd4e6739a87e11285f50364ac3304c /panels
parentae16a8e7a0ffac76e767fda9c4efa7c10f959440 (diff)
downloadgnome-control-center-d07a67fcb3c6c778d3df621d9643712b89410442.tar.gz
user-accounts: Validate password before moving focus
If <tab> is pressed and password is not yet validated (ie. the verify entry is not sensitive), focus skips the verify entry, even if the password is strong enough. Let's validate the password when <tab> is pressed (ie. before focus change) to prevent this <tab> breakage... https://gitlab.gnome.org/GNOME/gnome-control-center/issues/38
Diffstat (limited to 'panels')
-rw-r--r--panels/user-accounts/um-account-dialog.c15
-rw-r--r--panels/user-accounts/um-password-dialog.c15
2 files changed, 30 insertions, 0 deletions
diff --git a/panels/user-accounts/um-account-dialog.c b/panels/user-accounts/um-account-dialog.c
index bdb950093..34d982664 100644
--- a/panels/user-accounts/um-account-dialog.c
+++ b/panels/user-accounts/um-account-dialog.c
@@ -514,6 +514,20 @@ on_password_focus_out (GtkEntry *entry,
return FALSE;
}
+static gboolean
+on_password_key_press_cb (GtkEntry *entry,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ UmAccountDialog *self = UM_ACCOUNT_DIALOG (user_data);
+ GdkEventKey *key = (GdkEventKey *)event;
+
+ if (key->keyval == GDK_KEY_Tab)
+ local_password_timeout (self);
+
+ return FALSE;
+}
+
static void
on_password_changed (GtkEntry *entry,
GParamSpec *pspec,
@@ -577,6 +591,7 @@ local_init (UmAccountDialog *self)
gtk_widget_set_sensitive (self->local_password, FALSE);
g_signal_connect (self->local_password, "notify::text", G_CALLBACK (on_password_changed), self);
g_signal_connect_after (self->local_password, "focus-out-event", G_CALLBACK (on_password_focus_out), self);
+ g_signal_connect (self->local_password, "key-press-event", G_CALLBACK (on_password_key_press_cb), self);
g_signal_connect_swapped (self->local_password, "activate", G_CALLBACK (dialog_validate), self);
g_signal_connect (self->local_password, "icon-press", G_CALLBACK (on_generate), self);
diff --git a/panels/user-accounts/um-password-dialog.c b/panels/user-accounts/um-password-dialog.c
index b3c8e8b54..97490a883 100644
--- a/panels/user-accounts/um-password-dialog.c
+++ b/panels/user-accounts/um-password-dialog.c
@@ -350,6 +350,19 @@ password_entry_focus_out (GtkWidget *entry,
return FALSE;
}
+static gboolean
+password_key_press (GtkEntry *entry,
+ GdkEvent *event,
+ UmPasswordDialog *um)
+{
+ GdkEventKey *key = (GdkEventKey *)event;
+
+ if (key->keyval == GDK_KEY_Tab)
+ password_entry_timeout (um);
+
+ return FALSE;
+}
+
static void
auth_cb (PasswdHandler *handler,
GError *error,
@@ -481,6 +494,8 @@ um_password_dialog_new (void)
G_CALLBACK (password_entry_changed), um);
g_signal_connect_after (widget, "focus-out-event",
G_CALLBACK (password_entry_focus_out), um);
+ g_signal_connect (widget, "key-press-event",
+ G_CALLBACK (password_key_press), um);
g_signal_connect_swapped (widget, "activate", G_CALLBACK (password_entry_timeout), um);
gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE);
um->password_entry = widget;