visa.buildfor.life keeps the immigration records of the foreigners B4L looks after. This first phase is the base the deadlines and extension packs build on (docs/PLAN.md, phases 2 to 7). - One Rust binary (axum 0.8, minijinja, sqlx on PostgreSQL) with its templates, static files and migrations compiled in. - Login through Kanidm (OpenID Connect with PKCE and a nonce, ES256), client visa-web, group visa; sessions in PostgreSQL keyed by the SHA-256 of the cookie. VISA_INSECURE_NO_LOGIN=1 for loopback development only. - Same-site check and form token on every POST; a CSP without inline script or style; security headers. - People: list with filter, page, create, edit, archive, restore. - Passports from the machine-readable zone with check digits (ICAO 9303 TD3); expiry warnings at 12 and 6 months. - Addresses in Thailand in the order Thai forms use, with the house master and the TM.30 receipt. - Append-only audit log of every view and change, with the names of the changed fields but never their values (PDPA); the Activity page. - Invented demo people (visa seed-demo, refused when login is on). - 40 tests: unit tests, pages with demo data, the forms, the audit log and the whole login against a fake OpenID provider. - CI: gitleaks over the history, fmt, clippy and the tests against PostgreSQL 18; the pre-commit secret scan.
47 lines
2.2 KiB
HTML
47 lines
2.2 KiB
HTML
{#- Form fields. Every field has a label, its error under it and the
|
|
error tied to the input for screen readers. -#}
|
|
|
|
{% macro text(name, label, value="", err="", hint="", req=false, type="text", list="", auto="off", cls="", ph="") -%}
|
|
<div class="field{% if err %} has-err{% endif %}{% if cls %} {{ cls }}{% endif %}">
|
|
<label for="f-{{ name }}">{{ label }}{% if req %} <span class="req" aria-hidden="true">*</span>{% endif %}</label>
|
|
<input id="f-{{ name }}" name="{{ name }}" type="{{ type }}" value="{{ value }}"{% if req %} required{% endif %}{% if list %} list="{{ list }}"{% endif %} autocomplete="{{ auto }}"{% if ph %} placeholder="{{ ph }}"{% endif %}{% if err %} aria-invalid="true" aria-describedby="e-{{ name }}"{% elif hint %} aria-describedby="h-{{ name }}"{% endif %}>
|
|
{%- if hint %}
|
|
<p class="hint" id="h-{{ name }}">{{ hint }}</p>
|
|
{%- endif %}
|
|
{%- if err %}
|
|
<p class="err" id="e-{{ name }}">{{ err }}</p>
|
|
{%- endif %}
|
|
</div>
|
|
{%- endmacro %}
|
|
|
|
{% macro select(name, label, value, options, err="", hint="", blank="Not recorded", cls="") -%}
|
|
<div class="field{% if err %} has-err{% endif %}{% if cls %} {{ cls }}{% endif %}">
|
|
<label for="f-{{ name }}">{{ label }}</label>
|
|
<select id="f-{{ name }}" name="{{ name }}"{% if err %} aria-invalid="true" aria-describedby="e-{{ name }}"{% endif %}>
|
|
<option value="">{{ blank }}</option>
|
|
{%- for o in options %}
|
|
<option value="{{ o[0] }}"{% if o[0] == value %} selected{% endif %}>{{ o[1] }}</option>
|
|
{%- endfor %}
|
|
</select>
|
|
{%- if hint %}
|
|
<p class="hint">{{ hint }}</p>
|
|
{%- endif %}
|
|
{%- if err %}
|
|
<p class="err" id="e-{{ name }}">{{ err }}</p>
|
|
{%- endif %}
|
|
</div>
|
|
{%- endmacro %}
|
|
|
|
{% macro area(name, label, value="", err="", hint="", rows=3, cls="", fcls="") -%}
|
|
<div class="field{% if err %} has-err{% endif %}{% if fcls %} {{ fcls }}{% endif %}">
|
|
<label for="f-{{ name }}">{{ label }}</label>
|
|
<textarea id="f-{{ name }}" name="{{ name }}" rows="{{ rows }}"{% if cls %} class="{{ cls }}"{% endif %} spellcheck="false"{% if err %} aria-invalid="true" aria-describedby="e-{{ name }}"{% endif %}>{{ value }}</textarea>
|
|
{%- if hint %}
|
|
<p class="hint">{{ hint }}</p>
|
|
{%- endif %}
|
|
{%- if err %}
|
|
<p class="err" id="e-{{ name }}">{{ err }}</p>
|
|
{%- endif %}
|
|
</div>
|
|
{%- endmacro %}
|