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,38 @@
|
||||
{% extends "client_base.html" %}
|
||||
{% import "_fields.html" as fm %}
|
||||
{% block main %}
|
||||
<div class="crumbs"><a href="{{ base }}">Your details</a></div>
|
||||
<h1 class="chead">Documents</h1>
|
||||
<p class="lead2">Scans or photos of your papers: the passport's photo page, a passport photo (4 x 6 cm), your visa, the arrival stamp, the TDAC, the work permit. Upload one kind at a time.</p>
|
||||
{% if files_on %}
|
||||
<form method="post" action="{{ base }}/documents" enctype="multipart/form-data" class="upload card" id="upload">
|
||||
<input type="hidden" name="csrf" value="{{ csrf }}">
|
||||
{%- if errors %}
|
||||
<div class="notice warn">Nothing was uploaded. Correct what is marked and choose the files again.</div>
|
||||
{%- endif %}
|
||||
{{ fm.select("kind", "What the files are", v.kind, kinds, err=errors.kind, blank="Choose", req=true) }}
|
||||
<div class="drop{% if errors.file %} has-err{% endif %}" data-max="{{ file_limit }}">
|
||||
<input type="file" id="f-file" name="file" multiple required accept="application/pdf,image/jpeg,image/png,image/webp" aria-describedby="h-file{% if errors.file %} e-file{% endif %}">
|
||||
<span class="drop-icon" aria-hidden="true">+</span>
|
||||
<label for="f-file"><b>Choose files</b> or take a photo</label>
|
||||
<span class="drop-names" data-drop-names></span>
|
||||
<span class="hint" id="h-file">PDF, JPEG, PNG or WebP, up to {{ file_limit_mb }} MB each, {{ max_files }} at once</span>
|
||||
</div>
|
||||
{%- if errors.file %}
|
||||
<p class="err" id="e-file">{{ errors.file }}</p>
|
||||
{%- endif %}
|
||||
{{ fm.text("note", "Note", v.note, err=errors.note, ph="page 2") }}
|
||||
<div class="formactions"><button type="submit" class="btn pri" id="upload-btn">Upload</button><a class="btn ghost" href="{{ base }}">Back</a></div>
|
||||
</form>
|
||||
{% else %}
|
||||
<div class="notice warn">Uploads are switched off on this server. Give your papers to B4L instead.</div>
|
||||
{% endif %}
|
||||
<section class="card" id="uploaded">
|
||||
<header><h2>Uploaded through this link</h2></header>
|
||||
{% for d in uploaded %}
|
||||
<div class="item"><div class="row"><b>{{ d.label }}</b><span class="muted small">{{ d.at }}</span></div><div class="muted small fname">{{ d.file_name }}, {{ d.size }}</div></div>
|
||||
{% else %}
|
||||
<p class="empty-inline">Nothing yet.</p>
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user