{# Namespaced under `notes/` so that two installed apps can both ship an index.html without colliding. Extends `base.html`, which resolves to the site's chrome if it has any and to podpack's default if it has not -- the plugin never has to know which. #} {% extends "base.html" %} {% block content %} {% if welcome %}
{{ welcome }}
{% endif %}

Notes

{# The browser's way in. `hidden_tag()` is what carries the CSRF token, and is the reason this is a flask-wtf form rather than markup written out by hand -- podpack installs no site-wide CSRFProtect, so a bare
posting to a cookie-authenticated route would take one from any origin that asked. #} {{ form.hidden_tag() }}

{{ form.text(rows=3, cols=60, placeholder="Write a note") }}

{# Every field's errors and not just the textarea's. A missing or expired CSRF token is an error on `csrf_token`, so rendering `text.errors` alone brought the page back silently unchanged with nothing said -- which is what the test asserting the message caught. #} {% for _field, errors in form.errors.items() %} {% for error in errors %}

{{ error }}

{% endfor %} {% endfor %}

{{ form.submit() }}

{% if notes %} {% else %}

You have no notes yet.

{% endif %}

These are yours alone. Post one with curl -X POST -H 'Content-Type: application/json' -H "Authentication-Token: $TOKEN" -d '{"text":"hello"}' /notes/ — flask-security issues $TOKEN in reply to a JSON POST to /login?include_auth_token.

{% endblock %}