mirror of
https://github.com/R0m1k3/Presencia.git
synced 2026-10-22 22:58:03 +02:00
Corrections issues de la revue de code
- Limite de connexion par (e-mail, IP) et par IP : un tiers ne peut plus bloquer le compte admin depuis une autre adresse ; mémoire bornée. - Ids canoniques uniquement (« 07 » contournait la protection du propre compte de l'admin). - Export : un cadre réactivé entre deux requêtes ne fait plus planter. - /auth/me lit le compte déjà chargé par requireAuth ; /auth/password et e-mail non textuel ne renvoient plus 500. - Planning : une écriture réussie n'est plus perdue quand un rechargement du même mois répond avant elle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D5Bdayziw6tybgqETZoNSt
This commit is contained in:
7 files changed
+68
-41
No files matched your search
@@ -51,7 +51,7 @@
|
||||
try { data = await res.json(); } catch (e) { /* empty body */ }
|
||||
// The session ended under us (expired, password reset, account
|
||||
// disabled): go back to the login screen instead of failing every call.
|
||||
if (res.status === 401 && state.user && !path.startsWith('/auth/')) {
|
||||
if (res.status === 401 && state.user && path !== '/auth/login') {
|
||||
location.reload();
|
||||
return new Promise(() => {});
|
||||
}
|
||||
@@ -490,6 +490,7 @@
|
||||
if (state.viewing) qs.set('user_id', state.viewing.id);
|
||||
const cal = await api(`/attendance?${qs}`);
|
||||
if (req !== planningReq) return;
|
||||
cal.key = qs.toString();
|
||||
state.cal = cal;
|
||||
renderPlanning();
|
||||
}
|
||||
@@ -624,10 +625,12 @@
|
||||
|
||||
// After a successful write, apply it to the month already in memory
|
||||
// instead of reloading the month: painting stays fluid. `cal` is the month
|
||||
// the write was made on; if the user moved to another month meanwhile,
|
||||
// there is nothing to patch.
|
||||
// the write was made on. It is matched by month and person, not by object:
|
||||
// a reload that answered before this write landed must get it too, while a
|
||||
// different month on screen must not.
|
||||
function patchEntries(cal, changes) {
|
||||
if (state.cal !== cal) return;
|
||||
if (!state.cal || state.cal.key !== cal.key) return;
|
||||
cal = state.cal;
|
||||
const map = new Map((cal.entries || []).map((e) => [`${e.date}|${e.period}`, e]));
|
||||
changes.forEach(({ date, period, status }) => {
|
||||
if (status) map.set(`${date}|${period}`, { date, period, status });
|
||||
|
||||
Reference in new issue
Block a user