Hi,

I want to set limit username and password length when user register new account ?
I don't want some user on my site (www.drupalvn.org) register new acount as a name: 1 or a or b or....
I know i can set deny in "Access rules" (admin panel) but i can't set all because its too much

sorry for my bad english
jingjang
Drupalvn.org - drupal vietnam community

Comments

deepak@dipak.org’s picture

Let's say you want to set the minimum length of username to be 6. Here's how to setup an access rule:

Access Type: allow
Rule Type: username
Mask: ______%

That's 6 dashes (_), followed by a percent sign.

I think that should work.

Deepak

VM’s picture

6 underscores

lungtung’s picture

OK, i have test, but its not work ???
after i do that, i click "check rules"
And drupal show me the message: "The username lan is allowed."
I think its not work
Any suggess ?
Thanks

lungtung’s picture

sorry, i think i must read some handbooks

basicmagic.net’s picture

subscribe

Drupal samurai for hire, based in Buffalo, New York, USA.
15+ years Drupal, 20+ years web.
http://basicmagic.net

GreenLED’s picture

If you have not figured out yet how to do this, here's something I came up with. I don't know if it's the proper way to go about it, but it DOES work.

Username (3-14 characters long)

deny username %_______________
deny username _
deny username __

Set these three rules -- all are deny rules associated with username. Copy and paste the rule (after username) and you should have a total of 3 rules set. Then adjust accordingly to your needs. the top rule is obviously the "no more than 14" character rule. If you need more "minumum" length you'll have to add more rules with more characters. Aparently you have to manually set every character. Time-consuming, but it works. I don't know again if this is the way to do it, but -- hey it works.

lungtung’s picture

Hi GreenLED

Yes, now i can say with you "hey it works"

many thank (-:

Drupal Vietnam community

GreenLED’s picture

Does Drupal 6 have some more controls for this? I haven't installed D6 yet so I was just wondering.

» Respectfully, GreenLED
» Stable Files . net

VM’s picture

access rules are the same in D6 as they are in D5 and are handled in administer -> access rules

GreenLED’s picture

I had hoped that there would be some more development on those controls, but thanks for the information anyhow.

» Respectfully, GreenLED
» Stable Files . net

wlx20005’s picture

Username (6+ characters long)
deny username _%
allow username _______%

benone’s picture

I'd like to reserve 4 (and less) letter accounts for special users. Only admin could create the account with less than 5 letters username.
How can I set the rules to let those special users normally login to their accounts ?

rocket777’s picture

first set a 'deny' access rule for 4 characters and less as noted in the above comments
and then 'allow' access to those usernames that the admin creates

E Ismail

Stomper’s picture

I'm surprised that you can set a minimum password length without creating rules, yet you still have to create rules to specify username length. Shouldn't this functionality be built in by now (D6)?

VM’s picture

Isn't available in D7 core either. When someone codes it and put's up a patch is when it will get into core I'd guess.

ss54’s picture

@VM
I noted that almost all the usernames of spam registrations are using long username. An Idea occurred to my mind, that if I use this rule and restrict the user name to be tween 4-8, these spammers will get busted. I also thought that spammers use different mechanism that do not go through these access rules. What do you think. I am suffering especially from Drupal 6 where Captcha and Botcha did not prove effective.

VM’s picture

that decision is yours. Any legitimate user that inputs a long user name would also be excluded from doing so. Personally, I'd try other modules than captcha or botcha like honeypot or mother may i. Limiting spam tends to mean you need to employ one or more methods and adjust as spam bots get smarter.

ss54’s picture

Many thanks for your insight, as I had not heard before about the new modules you mentioned.

ss54’s picture

BTW, how about if I want to restrict the size of username to 10. ie not exceeding 10 characters, how one does this by access rules.

VM’s picture

That's explained through out this thread. I suggest reading the comments.

ss54’s picture

Thank you I can note it now.