By seloqxt on
Drupal by default allows the use of spaces in the username. I want to prevent this. How can I do it? I have looked at the site settings and registration settings, but there doesn't seem to be any option for disabling spaces in usernames. Any help will be appreciated. Thanks.
Comments
you can set this in your Access Rules
- select Add Rule
- Access Type => Deny
- Rule Type => Username
- Mask => % % (note the space between the %'s)
Something more...
And if I need to disallow:
- All Uppercase
- All special character
leaving only "lowercase" and numer?
There's an easy solution?
Thanks!
Allow only lowercase alpha-numetic characters in username
Go to admin/user/rules and add the following rules
deny username %
allow username %a%
allow username %b%
allow username %c%
allow username %d%
allow username (upto z)
allow username %0%
allow username %1%
allow username (upto 9)
Man this sucked. I entered
Man this sucked. I entered all of 'em (a-z,A-Z,0-9), only to find out that this person is mistaken.
Then to add insult to injury, I come back to this page only to notice after the fact that the user's name is "novice.drupaler" ; )
:) LOL
:) LOL
this doesn't works..
this doesn't works..
Custom username validation
https://drupal.org/project/custom_username_validation
I used
/^(?!(?:admin|node|user)$)[A-Za-z0-9_\.\-]{2,}$/to have a username that:Thanks.
https://lolandese.github.io/
Why does Drupal (out of the
Why does Drupal (out of the box) not have better limitation on the usernames??? I don't get it, basically you can create a username with just about anything right????
Can someone tell me why the heck Drupal has this help text under the username field on the sign up page: Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.
This is obviously BS as you can create a username that looks like this hsd#$!'blah!
I think usernames should be very limited in what you allow. On the access rules section in admin, is there a way to setup rules to say disallow EVERYTHING and then add just a few lines for what you will allow? I'm just so surprised this isn't something standard and more intuitive.
=-=
:eyeroll: took me less time to google than it did for you to type out that rant. see https://www.drupal.org/project/custom_username_validation
else you can write your own custom validation function
I already found that module
I already found that module prior to my post. It doesn't really answer my concerns or questions ::: eye roll :::
My question is why would the default text state that punctuation is not allowed except for x, y, and z, yet a lot of other characters and stuff are allowed. A hyphen is no more punctuation than a !, and I think that will take.
It would be nice if you could have the access rules apply in the opposite format. I.e. instead of having to write rules that you disallow, you could simply write rules that you allow. Giving both options would be nice. Anyways, just my opinion. And for the record, this took me a whole minute and a half to write...probably less...but definitely less than going through a google search and reading through a few pages before finding a link. I guess I type quicker than most.
=-=
As far as why core doesn't allow hypens in usernames I can't speak on. I'd venture that there is an issue in the queue when the function was added to core that can be researched. If you don't like the way core does it raise the way to get it changed is by raising an issue in the 8.x issue queue (assuming the function hasn't changed to your liking in 8.x.)