Phase 1: app, Kanidm login, people, passports, addresses, audit log
CI / secret scan (push) Successful in 4s
CI / fmt, clippy, tests (push) Successful in 42s

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.
This commit is contained in:
grabowski committed 2026-11-17 16:58:48 +07:00
commit 2e009700a9
56 files changed
+11193

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
{% extends "base.html" %}
{% import "_fields.html" as fm %}
{% block main %}
{% include "_person_head.html" %}
<form method="post" action="{{ action }}" class="form" id="address-form">
<input type="hidden" name="csrf" value="{{ csrf }}">
<section class="card">
<header><h2>{{ heading }}</h2></header>
<p class="hint lead">In the order Thai forms use. Leave out what the address does not have.</p>
<div class="grid">
{{ fm.text("house_no", "House number", af.house_no, err=errors.house_no, ph="99/9") }}
{{ fm.text("moo", "Moo (village number)", af.moo, err=errors.moo) }}
{{ fm.text("building", "Village, building or condominium", af.building, err=errors.building, hint="With the room number, if any.", cls="wide") }}
{{ fm.text("soi", "Soi", af.soi, err=errors.soi) }}
{{ fm.text("road", "Road", af.road, err=errors.road) }}
{{ fm.text("subdistrict", "Subdistrict (tambon)", af.subdistrict, err=errors.subdistrict) }}
{{ fm.text("district", "District (amphoe)", af.district, err=errors.district, req=true) }}
{{ fm.text("province", "Province", af.province, err=errors.province, req=true, list="provinces") }}
{{ fm.text("postal_code", "Postal code", af.postal_code, err=errors.postal_code) }}
{{ fm.text("moved_in_on", "Moved in on", af.moved_in_on, err=errors.moved_in_on, type="date") }}
{{ fm.text("moved_out_on", "Moved out on", af.moved_out_on, err=errors.moved_out_on, type="date", hint="Empty while the person lives here.") }}
</div>
</section>
<section class="card">
<header><h2>House master and TM.30</h2></header>
<p class="hint lead">The owner or landlord reports the person's address on form TM.30 within 24 hours of arrival, also after every trip abroad. Extensions of stay and 90-day reports ask for the receipt.</p>
<div class="grid">
{{ fm.text("house_master", "House master", af.house_master, err=errors.house_master, hint="The owner or landlord who files TM.30.") }}
{{ fm.text("house_master_phone", "House master's phone", af.house_master_phone, err=errors.house_master_phone, type="tel") }}
{{ fm.text("tm30_reported_on", "TM.30 reported on", af.tm30_reported_on, err=errors.tm30_reported_on, type="date") }}
{{ fm.text("tm30_receipt_no", "TM.30 receipt number", af.tm30_receipt_no, err=errors.tm30_receipt_no) }}
</div>
</section>
<div class="formactions">
<button type="submit" class="btn pri" id="save">Save</button>
<a class="btn ghost" href="/people/{{ p.id }}#addresses">Cancel</a>
</div>
</form>
<datalist id="provinces">{% for pv in provinces %}<option value="{{ pv }}"></option>{% endfor %}</datalist>
{% if mode == "edit" %}
<form method="post" action="{{ action }}/delete" class="dangerzone" data-confirm="Delete this address from the record?">
<input type="hidden" name="csrf" value="{{ csrf }}">
<button type="submit" class="btn sm danger">Delete this address</button>
<span class="muted small">For an address entered by mistake. When the person moves, set the move-out date instead and add the new address.</span>
</form>
{% endif %}
{% endblock %}