Commit 6e2c019e by PLN (Algolia)

couple: login page ships with the site — sas form was server-only and rsync wiped it

The 2026-10-14 token-cookie gate referenced public/login-couple.html, but the
form was only ever written on the box: the next rsync --delete mirror removed
it and /couple served a bare nginx 404 to every visitor. The form now lives in
the repo (ships in out/), hashes clarte-couple-v1:<password> to the Secure
cookie as before, detects the wrong-password bounce via a sessionStorage flag
to show an inline error instead of re-serving silently, and wears the Clarté
identity (paper/ink/teal, Atkinson, 44px touch targets).
parent 4bfbdc26
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex">
<title>Clarté couple — accès</title>
<style>
/* Clarté identity (components/clarte/README.md §committed identity) :
paper #faf8f4, ink #3a3630, teal #3e7d78, Atkinson Hyperlegible. */
@font-face {
font-family: 'Atkinson Hyperlegible';
src: url('/fonts/AtkinsonHyperlegible-Regular.woff2') format('woff2');
font-weight: 400;
font-display: swap;
}
@font-face {
font-family: 'Atkinson Hyperlegible';
src: url('/fonts/AtkinsonHyperlegible-Bold.woff2') format('woff2');
font-weight: 700;
font-display: swap;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
background: #faf8f4;
color: #3a3630;
font-family: 'Atkinson Hyperlegible', system-ui, -apple-system, sans-serif;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 1.5rem;
}
main { width: 100%; max-width: 24rem; }
h1 {
font-size: 1.35rem;
line-height: 1.3;
margin: 0 0 0.35rem;
}
p.lead {
margin: 0 0 1.4rem;
font-size: 0.95rem;
line-height: 1.55;
color: #6b6459;
}
form { display: flex; flex-direction: column; gap: 0.7rem; }
label { font-size: 0.9rem; font-weight: 700; }
input[type="password"] {
font: inherit;
font-size: 1.05rem;
padding: 0.65rem 0.8rem;
border: 1px solid #c9c2b6;
border-radius: 8px;
background: #fff;
color: inherit;
min-height: 44px;
}
input[type="password"]:focus-visible {
outline: 2px solid #3e7d78;
outline-offset: 1px;
border-color: #3e7d78;
}
button {
font: inherit;
font-weight: 700;
min-height: 44px;
padding: 0.65rem 1rem;
border: 0;
border-radius: 8px;
background: #3e7d78;
color: #fff;
cursor: pointer;
}
button:hover { background: #356b67; }
button:focus-visible { outline: 2px solid #3a3630; outline-offset: 2px; }
button[disabled] { opacity: 0.55; cursor: wait; }
.error {
display: none;
margin: 0.9rem 0 0;
padding: 0.6rem 0.8rem;
border-radius: 8px;
background: #f6e8e4;
color: #8a3d2e;
font-size: 0.9rem;
line-height: 1.5;
}
.error.on { display: block; }
noscript p {
margin: 0.9rem 0 0;
font-size: 0.9rem;
color: #8a3d2e;
}
</style>
</head>
<body>
<main>
<h1>Clarté couple</h1>
<p class="lead">Cet espace contient des questionnaires personnels.
Saisissez le mot de passe qui vous a été communiqué pour y accéder.</p>
<form id="gate" novalidate>
<label for="pw">Mot de passe</label>
<input id="pw" name="pw" type="password" autocomplete="current-password"
autocapitalize="off" spellcheck="false" autofocus>
<button type="submit" id="go">Entrer</button>
</form>
<p class="error" id="err" role="alert">Mot de passe incorrect. Réessayez,
ou demandez-le à nouveau à la personne qui vous a invité.</p>
<noscript><p>Cette page a besoin de JavaScript pour vérifier le mot de passe.</p></noscript>
</main>
<script>
/* Schéma du sas (vhost me.nech.pl, décision 2026-10-14) : le mot de passe ne
traverse jamais le réseau — on calcule ici SHA-256 de
"clarte-couple-v1:<password>" et on envoie le jeton hexadécimal en cookie
Secure `clarte`. nginx valide ce jeton côté serveur et sert /couple.
Un mauvais mot de passe donne un mauvais jeton : nginx renvoie le sas. */
(function () {
var SALT = 'clarte-couple-v1:';
var COOKIE = 'clarte';
var DAYS = 180;
var form = document.getElementById('gate');
var pw = document.getElementById('pw');
var go = document.getElementById('go');
var err = document.getElementById('err');
/* Un mauvais mot de passe reboucle ici (401 → error_page =200, même URL) :
le fanion posé avant la redirection distingue l'arrivée du rebond et
affiche l'erreur au lieu de re-servir le formulaire en silence. */
try {
if (sessionStorage.getItem('clarte-gate-attempted') === '1') {
sessionStorage.removeItem('clarte-gate-attempted');
err.classList.add('on');
pw.focus();
}
} catch (e) {}
function hex(buf) {
var v = new Uint8Array(buf), s = '';
for (var i = 0; i < v.length; i++) s += ('0' + v[i].toString(16)).slice(-2);
return s;
}
form.addEventListener('submit', function (e) {
e.preventDefault();
err.classList.remove('on');
var value = pw.value;
if (!value) { pw.focus(); return; }
go.disabled = true;
crypto.subtle.digest('SHA-256', new TextEncoder().encode(SALT + value))
.then(function (buf) {
document.cookie = COOKIE + '=' + hex(buf) +
'; Path=/; Max-Age=' + (DAYS * 24 * 3600) +
'; Secure; SameSite=Lax';
try { sessionStorage.setItem('clarte-gate-attempted', '1'); } catch (e) {}
location.replace('/couple');
})
.catch(function () {
go.disabled = false;
err.textContent = 'Impossible de vérifier le mot de passe dans ce navigateur.';
err.classList.add('on');
});
});
})();
</script>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment