diff MoinMoin/config/multiconfig.py @ 5924:9894a3344118

default password_checker function now customizable
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 19 Jan 2013 01:14:06 +0100
parents 25900eaeb864
children 96ef8a8ecc80
line wrap: on
line diff
--- a/MoinMoin/config/multiconfig.py	Sat Jan 19 00:33:07 2013 +0100
+++ b/MoinMoin/config/multiconfig.py	Sat Jan 19 01:14:06 2013 +0100
@@ -693,7 +693,8 @@
     # the options dictionary.
 
 
-def _default_password_checker(cfg, request, username, password):
+def _default_password_checker(cfg, request, username, password,
+                              min_length=6, min_different=4):
     """ Check if a password is secure enough.
         We use a built-in check to get rid of the worst passwords.
 
@@ -707,9 +708,9 @@
     """
     _ = request.getText
     # in any case, do a very simple built-in check to avoid the worst passwords
-    if len(password) < 6:
+    if len(password) < min_length:
         return _("Password is too short.")
-    if len(set(password)) < 4:
+    if len(set(password)) < min_different:
         return _("Password has not enough different characters.")
 
     username_lower = username.lower()