Closed (fixed)
Project:
Custom username validation
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Oct 2012 at 20:49 UTC
Updated:
10 Jul 2017 at 09:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
q0rban commentedThis is a bug in the form_alter, I believe. The only form that is being validated against is the user_register form.
Comment #2
q0rban commentedAttached patch fixes it for me. I did a bit of refactoring here to get the affected code in line with drupal coding standards. Note, there is another permission to bypass any validation, so be sure no roles have that permission set.
Comment #3
q0rban commentedComment #4
semei commentedCan this be commited?
Comment #5
lolandese commentedWorks as expected.
Note that the user should NOT have the permission 'Override custom username validation' to have validation or custom messages.
Thanks q0rban.
Off topic:
I used
/^(?!(?:admin|node|user)$)[A-Za-z0-9_\.\-]{2,}$/to have a username that:Comment #5.0
lolandese commentedtypo
Comment #6
webservant316 commentedwhat is the conclusion here? I just noticed that my validation requirements are still bypassed when the user edits their existing username. The requirements are there for new registrations.
I am confused by #5 above. This does not seem to be working as expected. I am using 7.x-1.1.
Comment #7
webservant316 commentedThe patch in #2 worked fine for me.
Hey how about a commit and push dev to 1.2?
Comment #8
sprite commentedThis problem can be fixed easily be editing line 224 of the custom_username_validation.module file to change the if statement as shown in the code below to include the:
user_profile_form
form.
Problem solved.
Hopefully the module author will make this change in the official code.
Comment #9
firewaller commentedAttached it the simplified patch outlined above.
Comment #10
q0rban commentedThanks for that, @sprite and @firewaller! Looking back, it appears the patch in #2 is identical in function, but adds some readability improvements. Either way the maintainer chooses should be fine. :)
Comment #11
Schneck commentedHi everyone,
thanks for the patches, unfortunately, as stated in the module description, this project is not maintained any more and is seeking an new maintainer. I haven't been working with Drupal for some years.
If you're interested in taking over, please drop me a note.
- Stefan
Comment #12
Schneck commentedQuick note: Today, lolandese offered his help to maintain the module, and I thankfully added him as co-maintainer.
Comment #14
lolandese commentedThanks for adding me.
James, thanks for your contribution.