On 08/29/2013 01:43 PM, Samantha N. Bueno wrote:
This is in keeping some consistency with GUI behavior, check a user's pw quality score and warn/prompt them to confirm whether they are ok with using a weak pw.
Resolves: rhbz#1001039
pyanaconda/ui/tui/spokes/__init__.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/ui/tui/spokes/__init__.py b/pyanaconda/ui/tui/spokes/__init__.py index 2f92126..fc904b3 100644 --- a/pyanaconda/ui/tui/spokes/__init__.py +++ b/pyanaconda/ui/tui/spokes/__init__.py @@ -22,7 +22,7 @@ from pyanaconda.ui.tui import simpleline as tui from pyanaconda.ui.tui.tuiobject import TUIObject, YesNoDialog from pyanaconda.ui.common import Spoke, StandaloneSpoke, NormalSpoke, PersonalizationSpoke, collect from pyanaconda.users import validatePassword -from pwquality import PWQError +import pwquality import re from collections import namedtuple from pyanaconda.iutil import setdeepattr, getdeepattr @@ -104,6 +104,25 @@ class EditTUIDialog(NormalTUISpoke): return True
def prompt(self, entry = None):
def _validatePassword(pw, confirm):""" Better password checking. This sets up a quality checkerto score password attempts. This is similar to the pw qualitycheck done in the GUI, except this only raises an error if apassword is weak."""# set up quality checker_pwq = pwquality.PWQSettings()_pwq.read_config()error = validatePassword(pw, confirm)if error:return errorstrength = _pwq.check(pw, None, None)if strength < 50:raise pwquality.PWQError
This should add a message for the exception handler.
Can we change users.validatePassword into something that both performs the validate check and returns a strength? Both the GUI and the TUI now are duplicating work done in validatePassword, and that's not so good.