mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
Moving the lockout counter to one per (user, source address) broke three readers that were still looking at the flat field it replaced: the People table's lock icon, its unlock click handler, and the lockedUsers methods behind them. Every account would have shown as unlocked, and no admin could have unlocked one. That is the "and nowhere else" half of the rule I had just written into CLAUDE.md, missed on the very next fix. The negative test now fails if anything reads the flat field again. models/lib/accountLockout.js is the one place that knows the shape - locked or not, since when, how many addresses and how many failures between them - so the client helper, the click handler and the server methods cannot drift apart again. Admin Panel / People / People answers WHY as well as whether: how many addresses were locked out of the account and how many failures they made. WHICH addresses is in Admin Panel -> Problems, where it is a tally rather than a field on every user document. Mongo cannot ask "which accounts are locked" over dynamically-named subdocuments without an aggregation, so a DISPLAY field - lockedUntil - is written beside the per-address state for that query alone. It is not the counter: the decision stays per address, and a test fails if the decision or the scope ever reads it, because a field that says "this ACCOUNT is locked" is the vulnerability that was just fixed. Unlocking one address clears it only when no other address is still locked. Thanks to daniais and xet7 !