Closed (fixed)
Project:
Custom username validation
Version:
6.x-1.2
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Jun 2010 at 02:26 UTC
Updated:
1 Jul 2010 at 19:20 UTC
I would like to limit usernames from being created like firstname.lastname because we use that for staff accounts. If I use this module, will the site admin be able to create user accounts in the admin with the firstname.lastname pattern for staff?
This would assume I'm using a regex that says the username cannot = firstname.lastname
Thanks for your help
Comments
Comment #1
skizzo commentedJust tried it. As it is now, the pattern is matched against all new usernames, also when created by admin.
Comment #2
Schneck commentedDoes it mean, your pattern works now as you need it?
Comment #3
skizzo commentedSorry. What I meant is that, in my understanding, the regex is applied irrespective of user id. Whether the registration is done by user 1 or not, it's irrelevant. Can we change this into a feature request? I.e.: do not apply regex when registrar is user 1)
Comment #4
gmclelland commentedI would like the regex applied to everyone except the admin(user 1) or maybe users that have a role like "Can bypass user validation".
Thanks @skizzo for trying it out.
Comment #5
Schneck commentedI implemented an override-permission now, thanks for the idea. there are some additional improvement in the 1.3, could you please check if everything's running fine? thanks.
Comment #6
gmclelland commentedThanks alot. You wouldn't happen to know the regex to exclude users from registering a username with the firstname.lastname format? I could test the module faster if I had the regex.
Comment #7
Schneck commentedis this the pattern you are looking for?
/^(?:(?![0-9a-zA-Z+]\.[0-9a-zA-Z+]).)*$/Comment #8
gmclelland commentedI'm not sure that regex works.
I tested on http://regexpal.com and http://www.gethifi.com/tools/regex
Here is my test criteria:
FIRSTNAME.LASTNAME
firstname.lastname
Firstname.Lastname
Thanks for the help
Maybe this will work ^[a-zA-Z]+[\.]+[a-zA-Z]+
Comment #9
Schneck commentedWell, I tested the pattern
^(?:(?![0-9a-zA-Z+]\.[0-9a-zA-Z+]).)*$on http://regexpal.com/, and it seems to work well. Please note, that the exact syntax depends on the parser; in php's preg_match(), the exact expression must be/^(?:(?![0-9a-zA-Z+]\.[0-9a-zA-Z+]).)*$/, containing slashes at begin and end.What you achieve to do is, that the user can register with anything but astring.astring, correct? In this case, it works.
Comment #10
gmclelland commentedThe new version works great! I really like the ajax regex tester, you should advertise that feature on the module's project page. Your regex also worked.
Thanks again for your help.