Files
Phillip Heller 31ee10c968 TOOLS: account-status server support + server-authoritative change-password retry (#131)
* Add TOOLS account-status server support

- Add MemberStatus: household-level PRF_SUFFIX_IN_USE_INDICATORS (#277) and per-slot PRF_INDICATORS active/enrolled bytes, denormalized on household.profile. The enroller seeds the A subscriber's bits at creation, enrollment sets the enrolled bit, and logon rejects a suspended member.
- Add a backfill migration for pre-existing households plus MemberStatus unit tests and a logon member-status test.
- Change-password verify-old-password: a write carrying the transient verify TAC (0x015D) is checked against the stored hash before anything is applied; a mismatch rejects the whole write and returns a short error, and the verify TAC is never persisted.
- Document the nil-actor admin bootstrap on grant_role_by_email.

* TOOLS: store + apply the household temporary password (#275)

- Enroller.do_create writes the creation password into household.profile #275 (key "0113") so it's a durable, displayable temp password, independent of the A user's own hashed #335 password.
- New-member initial password now sources from #275 instead of user.password (the subscriber's current password), at both the enrollment and profile-write call sites; falls back to user.password for pre-#275 households.
- Portal signup generates a 6-char initial password (was 8).
- enroller_test asserts #275 is stored at creation for named and un-named subscribers.

* profile: server-authoritative change-password retry counter (#340)

- Count failed old-password verifies in #340 (0x0154), stored as an ASCII digit string (JSONB cannot hold a NUL); lock the change-password write at 3 tries and reset the counter to 0 on a successful change via User.changeset.
- Reload the user from the DB at the top of every profile request so a context.user cached at logon cannot bypass, or falsely trigger, the lockout.
- Add server tests: retry counter (lock/increment/reset/representation), profile scope, and the read-through reload (stale context.user) cases.

* profile: let a subscriber write their own :user fields (own password)

- write_authorized? treated :subscriber and :user as disjoint, so a subscriber (id ending in A) was rejected on their own password change (0x014F, update [:user]) - the primary use case. A subscriber now also satisfies a :user requirement, on top of subscriber-only fields.
- Add a test that a slot-A subscriber's own password change succeeds.

* Block client writes to the change-password try counter (#340)

Add explicit security %{retrieve: [:user], update: []} to the 0x0154 ProfileSchema entry so the counter can be retrieved but never written by a client; write_authorized? rejects any profile-write packet that includes 0x0154 wholesale.
Server-side increment/reset still work because they go through User.changeset and bypass the scope check.
Add server tests: a change-password packet that also writes 0x0154 is rejected (status 0x05, counter unchanged), and a normal change-password still succeeds and resets #340 to "0".

* portal: admin "Password change inhibited" checkbox with unlock

- Add a "Password change inhibited" checkbox to the Service User detail page (Personal Info tab, Status group): checked when the #340 counter is at the limit; unchecking resets it to unlock, and a successful password reset also clears it.
- The hint text lives in an info-icon title tooltip.
- Read and write the counter as an ASCII digit string, matching the server representation.

* Backfill household temporary password (0x0113) for pre-existing accounts

- Seed profile["0113"] with a fresh random 6-char password (same A-Z/2-9 no-I/O/0/1 alphabet as new-account creation) for households created before it was stored; only when the key is missing (idempotent), leaving the A user's own login password untouched.
- The TOOLS Member Information screen and the Add/Suspend enrollment flow need a plaintext household password; without this, pre-existing households have none and the original plaintext is unrecoverable, so a new one is minted.
2026-08-07 14:36:05 -06:00
..
2022-11-24 22:34:37 -07:00