{% if current_person.signed_in? %}
  {% for group in current_person.groups %}
    {% if group.id == '4c891447-6820-4882-8b58-f261f279b80d' or group.id == '4e45477f-1cb2-4852-b250-9f705004ab38' %}
      {% assign today = 'now' | date: '%s' | plus: 0 %}
      {% assign end_of_demo =  group.enrolled_at | date: '%s' | plus: 1209600 %}
      {% if today > end_of_demo %}
        <body>
          <div class='text'
          style="display: flex; margin: 200px auto; font-size: 44px; text-align: center; justify-content: center;"
          >Your trial has ended</div>
        </body>
        <script>
          var form_data = JSON.stringify({
            user_id: '{{ current_person.id }}',
            user_email: '{{ current_person.email }}'
          })
          var xhr = new XMLHttpRequest();
          var url = "https://www.workato.com/webhooks/rest/bd1a1eb7-7e79-4208-a1db-8e9c7440bcc9/deactivate_user";
          xhr.open("POST", url, true);
          xhr.send(form_data);
        </script>
      {% else %}
        <script>
          window.location.replace('/app')
        </script>
      {% endif %}
      {% break %}
    {% endif %}
  {% endfor %}
{% endif %}
