[gnome-control-center] user-accounts: Don't reject passwords that pwquality says are ok
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] user-accounts: Don't reject passwords that pwquality says are ok
- Date: Thu, 14 Feb 2013 09:11:38 +0000 (UTC)
commit 973d1cac6bc0d065af1b5e07435c42b6bec2eea1
Author: Michael Catanzaro <mike catanzaro gmail com>
Date: Wed Jan 16 17:46:53 2013 -0600
user-accounts: Don't reject passwords that pwquality says are ok
Fix for the OK button being insensitive for many "weak" passwords
Also fixes "not good enough" password being accepted
https://bugzilla.gnome.org/show_bug.cgi?id=691907
panels/user-accounts/um-password-dialog.c | 54 +++++++++++++++-------------
1 files changed, 29 insertions(+), 25 deletions(-)
---
diff --git a/panels/user-accounts/um-password-dialog.c b/panels/user-accounts/um-password-dialog.c
index 655bfc6..47acd17 100644
--- a/panels/user-accounts/um-password-dialog.c
+++ b/panels/user-accounts/um-password-dialog.c
@@ -68,6 +68,31 @@ typedef enum {
UM_PASSWORD_DIALOG_MODE_UNLOCK_ACCOUNT
} UmPasswordDialogMode;
+static int
+update_password_strength (UmPasswordDialog *um)
+{
+ const gchar *password;
+ const gchar *old_password;
+ const gchar *username;
+ gint strength_level;
+ const gchar *hint;
+ const gchar *long_hint;
+
+ password = gtk_entry_get_text (GTK_ENTRY (um->password_entry));
+ old_password = gtk_entry_get_text (GTK_ENTRY (um->old_password_entry));
+ username = act_user_get_user_name (um->user);
+
+ pw_strength (password, old_password, username,
+ &hint, &long_hint, &strength_level);
+
+ gtk_level_bar_set_value (GTK_LEVEL_BAR (um->strength_indicator), strength_level);
+ gtk_label_set_label (GTK_LABEL (um->strength_indicator_label), hint);
+ gtk_widget_set_tooltip_text (um->strength_indicator, long_hint);
+ gtk_widget_set_tooltip_text (um->strength_indicator_label, long_hint);
+
+ return strength_level;
+}
+
static void
generate_one_password (GtkWidget *widget,
UmPasswordDialog *um)
@@ -259,18 +284,20 @@ update_sensitivity (UmPasswordDialog *um)
const gchar *old_password;
const gchar *tooltip;
gboolean can_change;
+ int strength_level;
password = gtk_entry_get_text (GTK_ENTRY (um->password_entry));
verify = gtk_entry_get_text (GTK_ENTRY (um->verify_entry));
old_password = gtk_entry_get_text (GTK_ENTRY (um->old_password_entry));
+ strength_level = update_password_strength (um);
- if (strlen (password) < pw_min_length ()) {
+ if (strength_level < 1) {
can_change = FALSE;
if (password[0] == '\0') {
tooltip = _("You need to enter a new password");
}
else {
- tooltip = _("The new password is too short");
+ tooltip = _("The new password is not strong enough");
}
}
else if (strcmp (password, verify) != 0) {
@@ -344,29 +371,6 @@ show_password_toggled (GtkToggleButton *button,
}
static void
-update_password_strength (UmPasswordDialog *um)
-{
- const gchar *password;
- const gchar *old_password;
- const gchar *username;
- gint strength_level;
- const gchar *hint;
- const gchar *long_hint;
-
- password = gtk_entry_get_text (GTK_ENTRY (um->password_entry));
- old_password = gtk_entry_get_text (GTK_ENTRY (um->old_password_entry));
- username = act_user_get_user_name (um->user);
-
- pw_strength (password, old_password, username,
- &hint, &long_hint, &strength_level);
-
- gtk_level_bar_set_value (GTK_LEVEL_BAR (um->strength_indicator), strength_level);
- gtk_label_set_label (GTK_LABEL (um->strength_indicator_label), hint);
- gtk_widget_set_tooltip_text (um->strength_indicator, long_hint);
- gtk_widget_set_tooltip_text (um->strength_indicator_label, long_hint);
-}
-
-static void
update_password_match (UmPasswordDialog *um)
{
const char *password;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]