[gnome-control-center] user-accounts: Correctly hide password mismatch warnings



commit 5e91cc714065b5b1df69825043b5293bae5d7072
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue Jul 10 15:18:43 2018 +0200

    user-accounts: Correctly hide password mismatch warnings
    
    The logic for the password mismatch warnings didn't handle the case where
    you deleted both the passwords - it would still show them as not
    matching.
    
    Fix this by handling the three cases:
    - Passwords are different
    - Passwords are the same
    - No passwords entered

 panels/user-accounts/um-account-dialog.c  | 5 +++--
 panels/user-accounts/um-password-dialog.c | 8 ++++----
 2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/panels/user-accounts/um-account-dialog.c b/panels/user-accounts/um-account-dialog.c
index af933677e..da229132a 100644
--- a/panels/user-accounts/um-account-dialog.c
+++ b/panels/user-accounts/um-account-dialog.c
@@ -456,17 +456,18 @@ update_password_match (UmAccountDialog *self)
 {
         const gchar *password;
         const gchar *verify;
+        const gchar *message = "";
 
         password = gtk_entry_get_text (GTK_ENTRY (self->local_password));
         verify = gtk_entry_get_text (GTK_ENTRY (self->local_verify));
         if (strlen (verify) != 0) {
                 if (strcmp (password, verify) != 0) {
-                        gtk_label_set_label (GTK_LABEL (self->local_verify_hint), _("Passwords do not 
match."));
+                        message = _("Passwords do not match.");
                 } else {
-                        gtk_label_set_label (GTK_LABEL (self->local_verify_hint), "");
                         set_entry_validation_checkmark (GTK_ENTRY (self->local_verify));
                 }
         }
+        gtk_label_set_label (GTK_LABEL (self->local_verify_hint), message);
 }
 
 static void
diff --git a/panels/user-accounts/um-password-dialog.c b/panels/user-accounts/um-password-dialog.c
index 50ad203b1..0ea1e715d 100644
--- a/panels/user-accounts/um-password-dialog.c
+++ b/panels/user-accounts/um-password-dialog.c
@@ -281,20 +281,20 @@ update_password_match (UmPasswordDialog *um)
 {
         const char *password;
         const char *verify;
+        const char *message = "";
 
         password = gtk_entry_get_text (GTK_ENTRY (um->password_entry));
         verify = gtk_entry_get_text (GTK_ENTRY (um->verify_entry));
 
-        if (strlen (password) > 0 && strlen (verify) > 0) {
+        if (strlen (verify) > 0) {
                 if (strcmp (password, verify) != 0) {
-                        gtk_label_set_label (GTK_LABEL (um->verify_hint),
-                                             _("The passwords do not match."));
+                        message = _("The passwords do not match.");
                 }
                 else {
-                        gtk_label_set_label (GTK_LABEL (um->verify_hint), "");
                         set_entry_validation_checkmark (GTK_ENTRY (um->verify_entry));
                 }
         }
+        gtk_label_set_label (GTK_LABEL (um->verify_hint), message);
 }
 
 static gboolean


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