Posted by jgalletta on July 22, 2011 at 8:53am
4 followers
| Project: | Password policy |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | major |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
The configuration option for username constraint is not taken in account when the constraints are tested, so the validation (both php and javascript) is always executed.
After some debug, the problem is that the configuration is simply not tested in the validation functions (see constraint_username.inc, functions password_policy_constraint_username_validate() and password_policy_constraint_username_js(), the $constraint parameter is never used...).
Comments
#1
Yeah, just needed to actually check if the contraint is true (or evaluates to true). This should work, but I don't have time to test it. It is patched against my other patch that provides the ability to check names of new users, so you will have to apply that first. See http://drupal.org/node/1226434#comment-4770124
Man, 3 patches for me to get this working :(
#2
Your patch works fine for the server side validation, but you forgot to also patch the javascript part :)
The same if with a return ''; if !$constraint in the js validation function should be fine.
#3
The server side validation patch works fine for me, now need a patch for client-side validation.
#4
Agreed, the patch in #1 looks like a win for the server-side. Any attempts on the JS side?
#5
Actually, I just tried to reproduce the problem and wasn't able to. I add a new policy, set username to '1', receive the error. Then erase the username value, then the error goes away.
I've attached a patch that should fix this problem, but I'm not really able to see what the problem is at the moment.
#6
Works for me, I wrote the same code a while back and it's working on live site since this time.
#7
The last submitted patch, password_policy-username_constraint_always_tested-1226418-5.patch, failed testing.
#8
I introduced a bug with that patch actually. The test itself was also broken. Re-running the tests with a new patch.
#9
http://drupalcode.org/project/password_policy.git/commit/fd4557a
#10
Automatically closed -- issue fixed for 2 weeks with no activity.