changeset 2997:c5cc1a0db4b2

fix password_checker userform code (port from 1.6)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 06 Jan 2008 17:26:27 +0100
parents 6a1b18869fe8
children 158ee5591ebc
files MoinMoin/action/newaccount.py MoinMoin/userprefs/changepass.py
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/newaccount.py	Sun Jan 06 17:08:31 2008 +0100
+++ b/MoinMoin/action/newaccount.py	Sun Jan 06 17:26:27 2008 +0100
@@ -48,18 +48,18 @@
     password = form.get('password', [''])[0]
     password2 = form.get('password2', [''])[0]
 
+    # Check if password is given and matches with password repeat
+    if password != password2:
+        return _("Passwords don't match!")
+    if not password:
+        return _("Please specify a password!")
+
     pw_checker = request.cfg.password_checker
     if pw_checker:
         pw_error = pw_checker(theuser.name, password)
         if pw_error:
             return _("Password not acceptable: %s") % pw_error
 
-    # Check if password is given and matches with password repeat
-    if password != password2:
-        return _("Passwords don't match!")
-    if not password:
-        return _("Please specify a password!")
-
     # Encode password
     if password and not password.startswith('{SHA}'):
         try:
--- a/MoinMoin/userprefs/changepass.py	Sun Jan 06 17:08:31 2008 +0100
+++ b/MoinMoin/userprefs/changepass.py	Sun Jan 06 17:26:27 2008 +0100
@@ -50,6 +50,8 @@
         # Check if password is given and matches with password repeat
         if password != password2:
             return _("Passwords don't match!")
+        if not password:
+            return _("Please specify a password!")
 
         pw_checker = request.cfg.password_checker
         if pw_checker: