Answers.Body: <p>The short answer is that freeform doesn't do it.</p>
  
  <p>The longer answer is that you can cheat with a cookie.</p>
  
  <p>I used a cookie. Used this plugin: <a href="https://github.com/nystudio107/cookies" rel="nofollow noreferrer">https://github.com/nystudio107/cookies</a></p>
  
  <p>In Freeform's admin, I created a hidden field called "cookie validator" and added it to my form.</p>
  
  <p>On the page that my form lives on /form/, I added a cookie that sets a value of a large random number.</p>
  
  <pre><code>{% set randomNumber = random(9999999999) %}
  {{ setCookie('formcookie', randomNumber, now | date_modify("+1 hour").timestamp ) }}
  
  {{ form.render }}
  
  {% set cookievalueJS %}
    $(document).ready(function() {
      $('#form-input-cookievalidator').val("{{ randomNumber }}");
   });
  {% endset %}
  {% includeJs cookievalueJS %}
  </code></pre>
  
  <p>This creates a random number first. Then sets a cookie with that number as a value. And then sets the input field to have that same number.</p>
  
  <p>Then, on my form results page /form/results/</p>
  
  <p>Instead of using an 'isSuccess' check, I check for the cookie &amp; field value...</p>
  
  <pre><code>{% set submissionId = segment2 %}
  {% set form = craft.freeform.form('myForm') %}
  {% set submission = craft.freeform.submissions({
      id: submissionId,
      form: formHandle,
  }).first() %}
  
  {% if myCookie  ==  submission.cookievalidator %}
    {# render all the submission data here #}
  {% else %}
    {# show the "nothing to show here" page #}
  {% endif %}
  </code></pre>
  
  <p>NOTE: I'm going to move this to an all https site eventually, and will probably have to swap the cookie to be a securecookie. But that's pretty straightforward with the cookie plugin.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-25T19:19:43.687Z
Answers.LastActivityDate: 2017-07-25T19:19:43.687Z
Answers.UserDisplayName: SamC
Body: <p>I've got a form that redirects to a results page on submission. Results page currently lives at <code>/form/results/[submission.id]/success/</code></p>
  
  <p>The results page shows the user's answers, and a bunch of other results.</p>
  
  <p>Is there a 'best' way to make it so that this results page is only accessible for the current user/session? I don't want to have it be available for any random joe to just try IDs and see someone else's results. </p>
  
Tags: <plugin-freeform><solspace>
Title: Freeform - limit who can view 'results' page
ThreadText: # Freeform - limit who can view 'results' page
  
  (Asked by: username_0 on 2017-07-05)
  
  I've got a form that redirects to a results page on submission. Results page currently lives at `/form/results/[submission.id]/success/`
  
  The results page shows the user's answers, and a bunch of other results.
  
  Is there a 'best' way to make it so that this results page is only accessible for the current user/session? I don't want to have it be available for any random joe to just try IDs and see someone else's results.
  
  **Tags:** plugin-freeform, solspace
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-07-25. Score: 1 | Accepted answer
  
  The short answer is that freeform doesn't do it.
  
  The longer answer is that you can cheat with a cookie.
  
  I used a cookie. Used this plugin: <https://github.com/nystudio107/cookies>
  
  In Freeform's admin, I created a hidden field called "cookie validator" and added it to my form.
  
  On the page that my form lives on /form/, I added a cookie that sets a value of a large random number.
  
  ```
  {% set randomNumber = random(9999999999) %}
  {{ setCookie('formcookie', randomNumber, now | date_modify("+1 hour").timestamp ) }}
  
  {{ form.render }}
  
  {% set cookievalueJS %}
    $(document).ready(function() {
      $('#form-input-cookievalidator').val("{{ randomNumber }}");
   });
  {% endset %}
  {% includeJs cookievalueJS %}
  
  ```
  
  This creates a random number first. Then sets a cookie with that number as a value. And then sets the input field to have that same number.
  
  Then, on my form results page /form/results/
  
  Instead of using an 'isSuccess' check, I check for the cookie & field value...
  
  ```
  {% set submissionId = segment2 %}
  {% set form = craft.freeform.form('myForm') %}
  {% set submission = craft.freeform.submissions({
      id: submissionId,
      form: formHandle,
  }).first() %}
  
  {% if myCookie  ==  submission.cookievalidator %}
    {# render all the submission data here #}
  {% else %}
    {# show the "nothing to show here" page #}
  {% endif %}
  
  ```
  
  NOTE: I'm going to move this to an all https site eventually, and will probably have to swap the cookie to be a securecookie. But that's pretty straightforward with the cookie plugin.
  
  
  ---
  
  