diff --git a/pydal/__init__.py b/pydal/__init__.py index e2b2c5033..5cb73c057 100644 --- a/pydal/__init__.py +++ b/pydal/__init__.py @@ -1,4 +1,4 @@ -__version__ = "20200429.3" +__version__ = "20200429.4" from .base import DAL from .objects import Field diff --git a/pydal/validators.py b/pydal/validators.py index 5683244cf..0667391c8 100644 --- a/pydal/validators.py +++ b/pydal/validators.py @@ -4507,15 +4507,15 @@ class IS_STRONG(Validator): >>> IS_STRONG(es=True, entropy=1, min=2)('a') ('a', 'Minimum length is 2') >>> IS_STRONG(es=True, entropy=100)('abc123') - ('abc123', 'Entropy (32.35) less than required (100)') + ('abc123', 'Password too simple (32.35/100)') >>> IS_STRONG(es=True, entropy=100)('and') - ('and', 'Entropy (14.57) less than required (100)') + ('and', 'Password too simple (14.57/100)') >>> IS_STRONG(es=True, entropy=100)('aaa') - ('aaa', 'Entropy (14.42) less than required (100)') + ('aaa', 'Password too simple (14.42/100)') >>> IS_STRONG(es=True, entropy=100)('a1d') - ('a1d', 'Entropy (15.97) less than required (100)') + ('a1d', 'Password too simple (15.97/100)') >>> IS_STRONG(es=True, entropy=100)('añd') - ('a\\xc3\\xb1d', 'Entropy (18.13) less than required (100)') + ('a\\xc3\\xb1d', 'Password too simple (18.13/100)') """ @@ -4565,7 +4565,7 @@ def validate(self, value, record_id=None): entropy = calc_entropy(value) if entropy < self.entropy: failures.append( - self.translator("Entropy (%(have)s) less than required (%(need)s)") + self.translator("Password too simple (%(have)s/%(need)s)") % dict(have=entropy, need=self.entropy) ) if isinstance(self.min, int) and self.min > 0: diff --git a/tests/validators.py b/tests/validators.py index 7172168a6..d2a410baa 100644 --- a/tests/validators.py +++ b/tests/validators.py @@ -1048,20 +1048,20 @@ def test_IS_STRONG(self): rtn = IS_STRONG(es=True, entropy=1, min=2)("a") self.assertEqual(rtn, ("a", "Minimum length is 2")) rtn = IS_STRONG(es=True, entropy=100)("abc123") - self.assertEqual(rtn, ("abc123", "Entropy (32.35) less than required (100)")) + self.assertEqual(rtn, ("abc123", "Password too simple (32.35/100)")) rtn = IS_STRONG(es=True, entropy=100)("and") - self.assertEqual(rtn, ("and", "Entropy (14.57) less than required (100)")) + self.assertEqual(rtn, ("and", "Password too simple (14.57/100)")) rtn = IS_STRONG(es=True, entropy=100)("aaa") - self.assertEqual(rtn, ("aaa", "Entropy (14.42) less than required (100)")) + self.assertEqual(rtn, ("aaa", "Password too simple (14.42/100)")) rtn = IS_STRONG(es=True, entropy=100)("a1d") - self.assertEqual(rtn, ("a1d", "Entropy (15.97) less than required (100)")) + self.assertEqual(rtn, ("a1d", "Password too simple (15.97/100)")) rtn = IS_STRONG(es=True, entropy=100)("añd") if PY2: self.assertEqual( - rtn, ("a\xc3\xb1d", "Entropy (18.13) less than required (100)") + rtn, ("a\xc3\xb1d", "Password too simple (18.13/100)") ) else: - self.assertEqual(rtn, ("añd", "Entropy (18.13) less than required (100)")) + self.assertEqual(rtn, ("añd", "Password too simple (18.13/100)")) rtn = IS_STRONG()("********") self.assertEqual(rtn, ("********", None)) rtn = IS_STRONG(es=True, max=4)("abcde")