I have a client content type with an email address and when a user creates an account I want to verify the users email address with the email address of the client content type to make sure that the user is an employee of the client and if so let them create an account.

My question is, can I make a rule which uses Regular expressions to compare the domain name of the two email fields?



  • What do you have available in your Drupal site (at the time an account gets created) to know which nodes of your client content type to consider for this validation. Just a wild guess: to create an account, the user enters an eMail ID, and the only thing in common to find a possible match with "a" client node that has that very same eMail Id stored as a value in one of its fields. Or to make things tougher: what follows after the @ sign for both eMail IDs must match. Just a guess, can you clarify to avoid this guessing? Also, why the need for the "RegEx"? Commented Jun 30, 2016 at 19:40

1 Answer 1


You can use access rules which is built into core drupal.

Go to "/admin/user/rules" and add a new rule, for example %@domain.com, this will allow anyone to register who has that specific domain.

  • Yeah I can't use that method because there a many clients all with different @domains.com
    – Wheelz
    Commented May 15, 2012 at 9:41
  • How many you need? we are currently using 19 for our company intranet, you start with a deny any rule and follow by allow for any domain you require
    – WestieUK
    Commented May 15, 2012 at 9:45
  • We could have potentially into the 100s. The other feature of this is that we 1: allow them to create accounts, but also 2: assign them to the specific client based on the @domain name too. So the client buys 10 licences. Then a user creates an account, it should check that they are using the correct domain, hence the domain check, and then assigns them to that client using one of the licences. I've done all the licence work using the rules module, but I need to do the authentication on the domain.
    – Wheelz
    Commented May 15, 2012 at 9:58
  • Ahh ok, my answer will unlikely be suitable
    – WestieUK
    Commented May 15, 2012 at 12:18
  • Can anyone else give me any ideas?
    – Wheelz
    Commented May 18, 2012 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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