From 6f9e1bfec05ed4dd0890ac65b4ccf25b843355d2 Mon Sep 17 00:00:00 2001 From: Mohammed Sadiq Date: Wed, 6 Sep 2023 12:48:42 +0530 Subject: [PATCH] user-accounts: Allow new password insert iff the old one is right Since the error message label provided at the bottom only says that the newly provided password is weak, it can be consfusing for the users as they might not understand why they can't press 'Accept' button. This could be especially true for color blind people. Fix it by allowing modification of new password entry only if the old provided password is correctly entered. --- panels/user-accounts/cc-password-dialog.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/panels/user-accounts/cc-password-dialog.c b/panels/user-accounts/cc-password-dialog.c index fc3d267dd..3eadad28b 100644 --- a/panels/user-accounts/cc-password-dialog.c +++ b/panels/user-accounts/cc-password-dialog.c @@ -208,6 +208,8 @@ update_sensitivity (CcPasswordDialog *self) can_change = TRUE; } + gtk_widget_set_sensitive (GTK_WIDGET (self->password_entry), self->old_password_ok); + gtk_widget_set_sensitive (GTK_WIDGET (self->verify_entry), self->old_password_ok); gtk_widget_set_sensitive (GTK_WIDGET (self->ok_button), can_change); } @@ -218,8 +220,8 @@ mode_change (CcPasswordDialog *self, gboolean active; active = (mode == ACT_USER_PASSWORD_MODE_REGULAR); - gtk_widget_set_sensitive (GTK_WIDGET (self->password_entry), active); - gtk_widget_set_sensitive (GTK_WIDGET (self->verify_entry), active); + gtk_widget_set_sensitive (GTK_WIDGET (self->password_entry), self->old_password_ok); + gtk_widget_set_sensitive (GTK_WIDGET (self->verify_entry), self->old_password_ok); gtk_widget_set_sensitive (GTK_WIDGET (self->old_password_entry), active); gtk_check_button_set_active (GTK_CHECK_BUTTON (self->action_now_radio), active); gtk_check_button_set_active (GTK_CHECK_BUTTON (self->action_login_radio), !active); @@ -395,6 +397,8 @@ old_password_entry_changed (CcPasswordDialog *self) gtk_widget_set_sensitive (GTK_WIDGET (self->ok_button), FALSE); self->old_password_ok = FALSE; + gtk_widget_set_sensitive (GTK_WIDGET (self->password_entry), self->old_password_ok); + gtk_widget_set_sensitive (GTK_WIDGET (self->verify_entry), self->old_password_ok); self->old_password_entry_timeout_id = g_timeout_add (PASSWORD_CHECK_TIMEOUT, (GSourceFunc) old_password_entry_timeout, self);