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?


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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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