0

I created a custom page for account activation failure and I'm telling Craft to route to my custom page by setting the general config setting activateAccountFailurePath. This works as expected.

What I'd like to do is prevent users from being able to directly navigate to the custom account activation failure page. I'd prefer this page only be displayed when Craft routes the user to it. Any suggestions?

Thanks

1

In your config, you can set activateAccountFailurePath to something like:

'activationAccountFailurePath' => 'members/failed?access=1'

In your template, you can check for the URL parameter 'access' and 404 if it is not set.

Template:

{% if craft.request.getParam('access') != '1' %}
   {% exit 404 %}
{% endif %}

{# rest of your template if parameter is available #}

Of course, someone could still access the page if they had the full URL with the parameter, but it should help limit access.

1
  • Yeah I was thinking that also. If this is the only viable option I guess that's what I'll do.
    – Matt V
    Apr 14 '15 at 12:47

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.