Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I created a module but I'm looking to have this module to intercept a user log in. I want to prevent any users with "test" in their login name from using the site. Is there a way to do this?

share|improve this question

2 Answers

Custom username validation would be an option

allows to define a validation pattern for the username on registration. it's also possible to customize the error message on validation failure.

share|improve this answer
I don't think it answers OP's concern. He wanted to prevent them from login, not registration. On many sites I have had users that was forbidden to login unless something got postal, like accounts for hosting company to let them test what's wrong. We simply inactivated them when not needed, but I can see how this is different need than just removing them altogether – Mołot Aug 19 at 14:15
@Mołot If it doesn't handle user login the OP can extract the code and apply it themselves. Or at least bother to reply to the answer within a week. I'm not writing a full tutorial for every low quality question that gets asked. People need to put effort in themselves, not rely on the few of us that bother to answer questions. You're free to downvote how you wish, of course, but I don't consider this to be a poor quality/un-useful answer (otherwise I'd just delete it). For the vague, broad question, it's a totally appropriate vague, broad answer. At least that's the story I'm sticking with ;) – Clive Aug 19 at 14:22

Hope this will help you,

In Drupal 7 you can achieve this using Clientside Validation module.

  • Clientside Validation : Adds clientside validation for all forms and webforms using jquery.validate

Note : Once module is enabled go through README.TXT for documentation.

References:

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.