# Automatic registration domain wild card

**URL:** https://meta.discourse.org/t/automatic-registration-domain-wild-card/146933
**Category:** Support
**Created:** [April 5, 2020, 10:39pm UTC](https://meta.discourse.org/t/automatic-registration-domain-wild-card/146933 "2020-04-05T22:39:00Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Rhidian](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rhidian/32/176630_2.png) [@Rhidian](https://meta.discourse.org/u/Rhidian)
#### Post date: [April 5, 2020, 10:39pm UTC](https://meta.discourse.org/t/automatic-registration-domain-wild-card/146933/1 "2020-04-05T22:39:01Z")

</div>

I’ve noticed a difference in behaviour between the email domains whitelist setting at registration - and the automatic registration email domains setting in manage groups.

I work in the NHS where users have email addresses with sub domains emails @organisation.nhs.uk

The whitelist lets them all register by adding top domain [nhs.uk](http://nhs.uk) to the list. That works well for me.

If I add the same top domain [nhs.uk](http://nhs.uk) to automatically add them to a group - it doesn’t add them - at least not retrospectively.

I would like the automatic group registration to behave as the whitelist does. I’ve tried a wildcard character asterisk but that doesn’t work.

Do you have any suggestions - other than going through and adding every sub domain?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [April 5, 2020, 11:01pm UTC](https://meta.discourse.org/t/automatic-registration-domain-wild-card/146933/2 "2020-04-05T23:01:11Z")

</div>

> [@Rhidian](#):
>
> it doesn’t add them - at least not retrospectively.

Why would retrospective addition be expected here? Couldn’t that be surprising and possibly even dangerous in other contexts?

(Thinking about this more, perhaps a dynamic pop-up prompt “do you want to make this retrospective, it will affect {x} users?” would work better?)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 6, 2020, 4:12am UTC](https://meta.discourse.org/t/automatic-registration-domain-wild-card/146933/3 "2020-04-06T04:12:46Z")

</div>

Yeah there is an inconsistency internally, our automatic group membership is based off a strict domain match per:

> <https://github.com/discourse/discourse/blob/40546af21746d469e39dfdcc9ca48987fef6cf3c/app/jobs/regular/automatic_group_membership.rb#L19-L19>

Our matcher for the `email_domains_whitelist` uses this match

> <https://github.com/discourse/discourse/blob/40546af21746d469e39dfdcc9ca48987fef6cf3c/lib/validators/email_validator.rb#L35-L35>

I think it makes sense to make this coherent and consistent.

@techAPJ can you adjust the group regex.. carefully and make sure it is tested so it also allows subdomains.

---

<div class="post-metadata">

### Author: ![Rhidian](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rhidian/32/176630_2.png) [@Rhidian](https://meta.discourse.org/u/Rhidian)
#### Post date: [April 6, 2020, 5:24am UTC](https://meta.discourse.org/t/automatic-registration-domain-wild-card/146933/5 "2020-04-06T05:24:35Z")

</div>

> [@codinghorror](#):
>
> Why would retrospective addition be expected here? Couldn’t that be surprising and possibly even dangerous in other contexts?

Discourse 2.4 does give this prompt to include member already registered with the domain. It’s a great feature and works well, aside from this inconsistency.

> [@sam](#):
>
> I think it makes sense to make this coherent and consistent.

Thank you 🙏

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [May 22, 2020, 3:21am UTC](https://meta.discourse.org/t/automatic-registration-domain-wild-card/146933/9 "2020-05-22T03:21:05Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
