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

skizzo’s picture

Just tried it. As it is now, the pattern is matched against all new usernames, also when created by admin.

Schneck’s picture

Does it mean, your pattern works now as you need it?

skizzo’s picture

Sorry. 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)

gmclelland’s picture

Category: support » feature

I 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.

Schneck’s picture

Status: Active » Fixed

I 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.

gmclelland’s picture

Thanks 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.

Schneck’s picture

is this the pattern you are looking for?

/^(?:(?![0-9a-zA-Z+]\.[0-9a-zA-Z+]).)*$/

gmclelland’s picture

I'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]+

Schneck’s picture

Well, 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.

gmclelland’s picture

The 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.