Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-29T18:06:04.140Z
Answers.LastActivityDate: 2014-10-29T18:06:04.140Z
Answers.UserDisplayName: Brad Bell
Body: <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>
  
Tags: <users>
Title: Limit Users Signup to Users from Specific Domain
ThreadText: # 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);
  }
  
  ```
  
  
  ---
  
  