With a simple rule, you can limit plan signups based on the user's email address domain.
We also have a code snippet that you can use to block specific email domains.
Let's say, for instance, you create a training course for a corporate client. With Memberstack, you can easily grant access to any company employee (with a corporate email account) and at the same time prevent the rest of the world from signing up. Here's how.
Creating a Rule
- Navigate to the plans page.
- Select a plan.
- Go to the panel on the right and expand the Signup Rules folder.
- Click the + Add button.
In the popup window:
- Enter the allowed domain.
- Click Save.
- Repeat steps to add more allowed domains. (optional)
Memberstack adds the rule to the plan. Click the ellipsis to edit or remove the signup rule.
- BTW This signup rule won't let you block certain email domains (e.g. prevent any user with a Yahoo email account from signing up). If you enable this feature, you block all users except people with the email domain listed in the rule.
Testing the Rule
Memberstack displays and error message and blocks a user from signing up if the email domain does not match the rule.
That's it.
Now you know how to restrict plan signups with an email domain rule.
Comments
10 comments
Is there a limit to how many domains you can whitelist this way?
Hey Jesper 👋 I'm honestly not sure... I have not tested. How many do you need to whitelist?
Hi Duncan! Up to around 200.
Hmmm yeah, we might need to find another solution. I imagine the cap (if there is one) is around 50. 200 at the highest.
What is your goal is limiting access to 200 emails? I wonder if there might be another way to achieve your goal.
It's for online membership for a group of institutions. The institutions pay offline and when they do, we whitelist their domains to allow their employees to get access online.
Hi Duncan, did you have a chance to investigate this further. I need to let my client know if we can build their workflow on this whitelisting domains concept or not. A cap of 200 would work in our case, but a cap of 50 would not.
I recommend this solution instead: https://docs.memberstack.com/hc/en-us/articles/12931245913243--Code-Blocklist-Email-Domains-during-Signup
OK, so we simply blacklist all domains in the world, except for the 200 we need to whitelist? :) Thanks for trying, but it doesn't really work for us. I think the whitelist approach is the right one - it just doesn't work in our case since we can't be sure if we hit a cap or not. We have found another solution: allowing anyone to sign up, and then occasionally reviewing new sign ups screening for domains that's not on our whitelist. It's not ideal, but the client can make it work.
Oh sorry, I didn't make that clear. You can invert the functionality of the script so that it acts as an allow list.
But yes, your solutions seems great too.
Ah, got it! Thanks! it might work!
Please sign in to leave a comment.