<p>Probably best to do all of this from a custom plugin (that way you can write the logic for the approval process).</p>

<p>But regardless, you can do something like this from the top of your template:</p>

<pre><code>{% if craft.request.getServerName() is not "mydomain.gov" %}
    {% exit 503 %}
{% endif %}
</code></pre>

<p>And similarly any controller actions would have:</p>

<pre><code>if (craft()-&gt;request-&gt;getServerName() !== 'mydomain.gov" )
{
    throw new HttpException(503);
}
</code></pre>

CC BY-SA 3.0
2014-10-29T18:06:04.140Z
2014-10-29T18:06:04.140Z
Brad Bell
<p>I have an eLearning page people from a .gov domain need to access.  I want them to be able to sign up for a user account and get immediate access, but I only want people from within that domain and perhaps one other to have this privilege.  I would want to approve any other users before they gain access.  Is this possible?</p>

<users>
Limit Users Signup to Users from Specific Domain
# Limit Users Signup to Users from Specific Domain

(Asked by: username_0 on 2014-10-29)

I have an eLearning page people from a .gov domain need to access. I want them to be able to sign up for a user account and get immediate access, but I only want people from within that domain and perhaps one other to have this privilege. I would want to approve any other users before they gain access. Is this possible?

**Tags:** users


---

## 1 answers

### Answer by username_1 on 2014-10-29. Score: 2 | Accepted answer

Probably best to do all of this from a custom plugin (that way you can write the logic for the approval process).
But regardless, you can do something like this from the top of your template:
{% if craft.request.getServerName() is not "mydomain.gov" %}
    {% exit 503 %}
{% endif %}

And similarly any controller actions would have:
if (craft()->request->getServerName() !== 'mydomain.gov" )
{
    throw new HttpException(503);
}


---

