Self-service password change (:change-password action hook)
A logged-in user without user-creator has no way to change
their own password: logged-in grants read only on :users, so
no Edit link, and be-update rejects with "does not have update
permission". The only workaround today is an admin/user-creator
editing the user row. Capability gap for every app.
Plan: change-password-plan.org. Summary:
- Built-in
:change-passwordaction hook hosted on the built-in:settingstype (every user holds the settings role; guest deliberately does not). - New no-column
:current-password/:new-passwordfields plus a:buttonfield on:settingsin*base-model*; the synthesized status companion gives result feedback and the in-progress guard for free. - One contract extension: the action payload carries form values
(
data) — todayhandleActionPOSTs only{type, id, field}andbe-actionre-reads the record with passwords blanked, so no hook can see typed input.be-actionforwards:dataas a new hook keyword. - Hook gates: own-row check (settings rows are not record-scoped
—
:scope :useris list-only), old-password verification viaa:login, new-password validation viaa:valid-password-p; write viabe-updateon:usersas "admin" (the:tokenscarve-out precedent), reusing the sanctioned hash/salt/blank path pinned bybe-update-base-type-path. - Write-through to
:userswas evaluated and rejected: identity resolution cannot match (textuser_namevs UUID tags → silent no-op), and if forced it would bind every:userscolumn, lack blank-password preservation, and bypass target permissions.
Note: settings table gains a setting_change_password_status column in
every deployment — existing DBs need ALTER or reset
(non-idempotent init is the known gap).
Implemented <span class="timestamp-wrapper"><span class="timestamp">[2026-09-25 Fri] </span></span> per the plan, no deviations:
lisp/model.lisp: settings fields + button in*base-model*(:add-formnarrowed to the real fields — buttons never ship there anyway and:create nilmeans no Add path ever renders);:change-passwordhook registered (own-row by username display value, blank/nil/absent:datatreated as missing — the frontend normalizes untouched boxes to");\&allow-other-keyson the three shipped action hooks (be-actionnow forwards:dataunconditionally). One addition beyond the plan:compile-fieldinjects a trivial:agg :firstself-source on no-column fields without a:source— without it the settings record re-read inbe-actioncrashed with "Invalid aggregation NIL" (view-result-valuesaggregates every form field).lisp/backend.lisp:be-actiontakes optionaldataand forwards it as:data.lisp/rest.lisp:/api/actionsparses:datafrom the body; docstring updated.web/src/App.tsx:handleActionruns the same password confirm-match gate assubmitFormand posts a whitelisteddatapayload (string-valued password/textbox/textarea/select/ code fields only; untouched passwords as") — never the rawformValuesspread.tests/change-password-tests.lisp(new, 9 tests / 42 checks: happy path, status transitions, wrong current, blank/absent fields, invalid new, own-row guard, no-persistence on plain Save, roles survive the elevated write, in-progress guard) +run-change-password-testsintests/helpers.lisp, registered indata-ui.asdandrun-tests.tests/action-tests.lisp:\&allow-other-keyson the three test hooks.- Docs:
hook-registry.md(action contract gains:data,:change-passwordentry),rest.md(datapayload),model-reference.md(:settingsrow).
Tests green: change-password 42/42, action 20/20, backend 556,
widget 47, secrets 30, lifecycle 28, form-fields 40, hook-registry,
m2m, agg-distinct, spawn, update-permission, scoping, generator —
all Fail: 0. Frontend rebuilt (npm run build). Existing DBs need
alter table settings add column setting_change_password_status
text not null default 'idle'; (or a reset); dev hard-reset
covers it.
Known warts accepted per plan (misleading "leave blank" placeholder
on no-column password fields; redundant confirm box on
Current Password); no token invalidation on change (MVP).
- Slot
- 28200
- Status
- 60 Done
- Tags
- mvp, backend, frontend, model
- Contributors
- Donnie