Phase 7: the client link
Staff make a link for a person (or "+ New client": a record with only the name they know, and its link); the client fills in their own record from their phone without a login, and presses Send. - Links (src/links.rs, migrations/0006): the table keeps the SHA-256 of the token only, as sessions do; the link is shown once, to copy, to email (mailto with the person's address) or as a QR code (qrcode crate, inline SVG). It is open 14 days, until Send, or until staff close it; a new link closes the earlier one. States open, opened, sent, closed, expired. - The client's pages at /c/<token> (src/web/client.rs, client_*.html in a frame of their own, phone first): About you, Passport (the photo reader; a zone fills in the personal details still empty), Address in Thailand, Contact, Documents, Send. Each part is saved on its own, straight into the record. Forms carry the link's own token plus the same-site check. A passport with the same number is changed; an address unlike the current one is added beside it, so the current one and its TM.30 receipt stay; a second save changes what the link added. Uploads (passport page, photo, visa, arrival stamp, TDAC, work permit, other) go through the same checks and encrypted store as staff uploads, tied to the person's newest record of their kind. - Audit: the client's views and changes carry the actor `link <id>`; actions send and close and entity link are new. The person's page shows the newest links, when they were opened and sent, and each record the client changed, with the fields, to check. - Demo data: Erika sent her link an hour ago (phone and email changed), Jane opened hers. - documents::read_upload returns why it refused, so the client's pages answer in their own words. Checks: fmt, clippy; 101 unit and 54 integration tests (tests/client.rs: the link shown once and kept as a hash, a new client, the whole client flow with the login on, forged, closed, expired and made-up links); layout check light/dark desk/phone on the client pages, the person page and the new client form: no problems; the camera reader on the client's passport page with a fake camera filled the form and Send closed the link.
This commit is contained in:
1 parent
a6ebdfc89c
commit
43ed75d81b
32 files changed
+2706
-40
No files matched your search
@@ -0,0 +1,23 @@
|
||||
{% extends "client_base.html" %}
|
||||
{% block main %}
|
||||
<h1 class="chead">{% if first_name %}Hello {{ first_name }}{% else %}Hello{% endif %}</h1>
|
||||
<p class="lead2">B4L looks after your visa and your stay in Thailand. Fill in the parts below. Each part is saved on its own, so you can stop and come back to this link. When everything is in, press Send.</p>
|
||||
{% if saved %}<div class="notice ok" role="status">Saved: {{ saved }}.</div>{% endif %}
|
||||
<ol class="parts">
|
||||
{% for p in parts %}
|
||||
<li>
|
||||
<a class="part{% if p.done %} done{% endif %}" href="{{ base }}/{{ p.slug }}" id="part-{{ p.slug }}">
|
||||
<span class="pmark" aria-hidden="true">{% if p.done %}✓{% else %}{{ loop.index }}{% endif %}</span>
|
||||
<span class="pbody"><b>{{ p.title }}</b><span class="muted small">{{ p.what }}</span></span>
|
||||
<span class="chip {% if p.done %}ok{% else %}warn{% endif %}">{{ p.status }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
<form method="post" action="{{ base }}/send" class="card sendcard" id="send"{% if missing %} data-confirm="Still to do: {{ missing|join(", ") }}. Send anyway? The link closes once it is sent."{% else %} data-confirm="Send your details to B4L? The link closes once it is sent."{% endif %}>
|
||||
<input type="hidden" name="csrf" value="{{ csrf }}">
|
||||
<h2>Send</h2>
|
||||
<p class="muted">{% if missing %}Still to do: {{ missing|join(", ") }}. You can send now and give the rest to B4L later.{% else %}Everything is in. Send it, and B4L checks it.{% endif %} After Send the link closes.</p>
|
||||
<button type="submit" class="btn pri" id="send-btn">Send to B4L</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user