From: "Brian C. Lane" bcl@redhat.com
We were inconsistent in our use of strength meters. This fixes a problem with user entry not showing the strength before entering the confirmation password, and it adds a strength meter to the root password entry. It uses the info bar to show that they mismatch while still showing the strength of the password entered. This is consistent with the LUKS passphrase entry dialog.
I think it would be nice to have these on F19.
Brian C. Lane (2): Show User password strength during entry Add password strength to root password spoke
pyanaconda/ui/gui/spokes/password.glade | 55 ++++++++++++++++++++++++++++-- pyanaconda/ui/gui/spokes/password.py | 59 ++++++++++++++++++++++++++++++++- pyanaconda/ui/gui/spokes/user.py | 36 +++++++++----------- 3 files changed, 126 insertions(+), 24 deletions(-)
From: "Brian C. Lane" bcl@redhat.com
The user password entry wasn't updating the strength until the confirmation password was entered. This changes it so that it will update while the first password is entered, and will leave the strength showing while the confirmation is entered. --- pyanaconda/ui/gui/spokes/user.py | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py index 2c9cd1b..aab5d3c 100644 --- a/pyanaconda/ui/gui/spokes/user.py +++ b/pyanaconda/ui/gui/spokes/user.py @@ -315,27 +315,14 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke): to the passwords entered by the user. It is called by the changed Gtk event handler. """ - if self.pw.get_text() == "": - strength = -2 - elif self.pw.get_text() != self.confirm.get_text(): - strength = -1 - else: - try: - strength = self._pwq.check(self.pw.get_text(), None, None) - _pwq_error = None - except pwquality.PWQError as (e, msg): - _pwq_error = msg - strength = 0 - - if strength == -1: - val = 0 - text = _("Mismatch!") - self._error = _("The passwords do not match!") - elif strength == -2: - val = 0 - text = _("Empty!") - self._error = _("The password is empty!") - elif strength < 50: + try: + strength = self._pwq.check(self.pw.get_text(), None, None) + _pwq_error = None + except pwquality.PWQError as (e, msg): + _pwq_error = msg + strength = 0 + + if strength < 50: val = 1 text = _("Weak") self._error = _("The password you have provided is weak") @@ -357,6 +344,13 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke): text = _("Strong") self._error = False
+ if not self.pw.get_text(): + val = 0 + text = _("Empty!") + self._error = _("The password is empty!") + elif self.confirm.get_text() and self.pw.get_text() != self.confirm.get_text(): + self._error = _("The passwords do not match!") + self.pw_bar.set_value(val) self.pw_label.set_text(text)
@@ -357,6 +344,13 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke): text = _("Strong") self._error = False
if not self.pw.get_text():val = 0text = _("Empty!")self._error = _("The password is empty!")elif self.confirm.get_text() and self.pw.get_text() != self.confirm.get_text():self._error = _("The passwords do not match!")self.pw_bar.set_value(val) self.pw_label.set_text(text)
I realize you're just moving the strings around. But, do they really deserve exclamation points?
- Chris
On Tue, Jun 04, 2013 at 11:07:28AM -0400, Chris Lumens wrote:
@@ -357,6 +344,13 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke): text = _("Strong") self._error = False
if not self.pw.get_text():val = 0text = _("Empty!")self._error = _("The password is empty!")elif self.confirm.get_text() and self.pw.get_text() != self.confirm.get_text():self._error = _("The passwords do not match!")self.pw_bar.set_value(val) self.pw_label.set_text(text)I realize you're just moving the strings around. But, do they really deserve exclamation points?
NO!
I can change them in both places.
From: "Brian C. Lane" bcl@redhat.com
--- pyanaconda/ui/gui/spokes/password.glade | 55 ++++++++++++++++++++++++++++-- pyanaconda/ui/gui/spokes/password.py | 59 ++++++++++++++++++++++++++++++++- 2 files changed, 111 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/password.glade b/pyanaconda/ui/gui/spokes/password.glade index 75ac957..cfd12a5 100644 --- a/pyanaconda/ui/gui/spokes/password.glade +++ b/pyanaconda/ui/gui/spokes/password.glade @@ -74,7 +74,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="top_attach">3</property> <property name="width">1</property> <property name="height">1</property> </packing> @@ -85,6 +85,7 @@ <property name="can_focus">True</property> <property name="visibility">False</property> <property name="invisible_char">●</property> + <signal name="changed" handler="_checkPassword" swapped="no"/> </object> <packing> <property name="left_attach">1</property> @@ -100,10 +101,11 @@ <property name="visibility">False</property> <property name="invisible_char">●</property> <property name="activates_default">True</property> + <signal name="changed" handler="_checkPassword" swapped="no"/> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">2</property> + <property name="top_attach">3</property> <property name="width">1</property> <property name="height">1</property> </packing> @@ -122,6 +124,55 @@ </packing> </child> <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkLevelBar" id="password_bar"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <property name="mode">GTK_LEVEL_BAR_MODE_DISCRETE</property> + <property name="min-value">0</property> + <property name="max-value">4</property> + <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> + <property name="value">2</property> + <property name="halign">fill</property> + <property name="valign">center</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="password_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">center</property> + <property name="xpad">6</property> + <property name="label" translatable="yes">empty password</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> <object class="GtkLabel" id="details"> <property name="visible">True</property> <property name="can_focus">False</property> diff --git a/pyanaconda/ui/gui/spokes/password.py b/pyanaconda/ui/gui/spokes/password.py index ff029ea..b496283 100644 --- a/pyanaconda/ui/gui/spokes/password.py +++ b/pyanaconda/ui/gui/spokes/password.py @@ -28,7 +28,8 @@ from pwquality import PWQError from pyanaconda.ui.gui.spokes import NormalSpoke from pyanaconda.ui.gui.categories.user_settings import UserSettingsCategory from pyanaconda.ui.common import FirstbootSpokeMixIn -#from _isys import isCapsLockEnabled + +import pwquality
__all__ = ["PasswordSpoke"]
@@ -62,6 +63,13 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalSpoke): self.pw.set_placeholder_text(_("The password was set by kickstart.")) self.confirm.set_placeholder_text(_("The password was set by kickstart."))
+ # set up passphrase quality checker + self._pwq = pwquality.PWQSettings() + self._pwq.read_config() + + self.pw_bar = self.builder.get_object("password_bar") + self.pw_label = self.builder.get_object("password_label") + def refresh(self): # self.setCapsLockLabel() self.pw.grab_focus() @@ -107,6 +115,55 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalSpoke): def completed(self): return bool(self.data.rootpw.password or self.data.rootpw.lock)
+ def _checkPassword(self, editable = None, data = None): + """This method updates the password indicators according + to the passwords entered by the user. It is called by + the changed Gtk event handler. + """ + try: + strength = self._pwq.check(self.pw.get_text(), None, None) + _pwq_error = None + except pwquality.PWQError as (e, msg): + _pwq_error = msg + strength = 0 + + if strength < 50: + val = 1 + text = _("Weak") + self._error = _("The password you have provided is weak") + if _pwq_error: + self._error += ": %s. " % _pwq_error + else: + self._error += ". " + self._error += _("You will have to press Done twice to confirm it.") + elif strength < 75: + val = 2 + text = _("Fair") + self._error = False + elif strength < 90: + val = 3 + text = _("Good") + self._error = False + else: + val = 4 + text = _("Strong") + self._error = False + + if not self.pw.get_text(): + val = 0 + text = _("Empty!") + self._error = _("The password is empty!") + elif self.confirm.get_text() and self.pw.get_text() != self.confirm.get_text(): + self._error = _("The passwords do not match!") + + self.pw_bar.set_value(val) + self.pw_label.set_text(text) + + self.clear_info() + if self._error: + self.set_warning(self._error) + self.window.show_all() + def _validatePassword(self): # Do various steps to validate the password # sets self._error to an error string
On Mon, 2013-06-03 at 11:08 -0700, Brian C. Lane wrote:
From: "Brian C. Lane" bcl@redhat.com
We were inconsistent in our use of strength meters. This fixes a problem with user entry not showing the strength before entering the confirmation password, and it adds a strength meter to the root password entry. It uses the info bar to show that they mismatch while still showing the strength of the password entered. This is consistent with the LUKS passphrase entry dialog.
I think it would be nice to have these on F19.
Brian C. Lane (2): Show User password strength during entry Add password strength to root password spoke
pyanaconda/ui/gui/spokes/password.glade | 55 ++++++++++++++++++++++++++++-- pyanaconda/ui/gui/spokes/password.py | 59 ++++++++++++++++++++++++++++++++- pyanaconda/ui/gui/spokes/user.py | 36 +++++++++----------- 3 files changed, 126 insertions(+), 24 deletions(-)
I've uploaded a screenshot of the new look [1] and I think: 1) the label next to the level bar should be vertically centered to the same level as the bar
2) there should be some spacing between the upmost label and the checkboxes
3) an "empty password" shouldn't fill the half of the meter with the first character typed getting it to lowest level
[1] http://vpodzime.fedorapeople.org/root_pw_meter.png
I've uploaded a screenshot of the new look [1] and I think:
- the label next to the level bar should be vertically centered to the
same level as the bar
- there should be some spacing between the upmost label and the
checkboxes
- an "empty password" shouldn't fill the half of the meter with the
first character typed getting it to lowest level
Yeah, agreed. At the least, set the row and column spacing in the box there to 6. That'll help space things out a bit internally. Then, either set a row spacing on the larger containing box to 6 as well, or set a top spacing or bottom spacing to separate out the leading text from the entry boxes.
- Chris
On Tue, Jun 04, 2013 at 11:06:43AM -0400, Chris Lumens wrote:
I've uploaded a screenshot of the new look [1] and I think:
- the label next to the level bar should be vertically centered to the
same level as the bar
- there should be some spacing between the upmost label and the
checkboxes
- an "empty password" shouldn't fill the half of the meter with the
first character typed getting it to lowest level
Yeah, agreed. At the least, set the row and column spacing in the box there to 6. That'll help space things out a bit internally. Then, either set a row spacing on the larger containing box to 6 as well, or set a top spacing or bottom spacing to separate out the leading text from the entry boxes.
Here's what it looks like now:
http://bcl.fedorapeople.org/images/rootpw-spoke.png
Ok for f19-branch too?
Here's what it looks like now:
http://bcl.fedorapeople.org/images/rootpw-spoke.png
Ok for f19-branch too?
Looks good to me.
- Chris
anaconda-patches@lists.fedorahosted.org