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
This commit is contained in:
parent
525adcf10b
commit
5e91cc7140
2 changed files with 7 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue