VAPP-21: User editing: real name, email, site admin toggle, clear 2FA, force password change #26

Merged
David merged 2 commits from feat/user-editing-vapp-21 into main 2026-06-07 19:44:36 +02:00
Owner

Resolves VAPP-21.

What

Extends the Users edit drawer (src/components/pages/users.rs) so admins can manage an account after creation, beyond the existing password reset and mesh membership.

Account section (new)

Real name input, email input, and a "Site administrator (full rights)" checkbox matching the create dialog's wording, seeded from the loaded User row. Save wraps a new edit_user server fn over vervain-server's edituser control action and refreshes the user list via the existing on_changed callback so the table reflects the new name / role.

The site-admin checkbox is disabled when the target is the signed-in user, so an admin cannot strip their own rights mid-session. The new get_current_user_id server fn reads userinfo._id from the control-channel connect burst to make that comparison.

Reset password section

Gains two checkboxes, "Also clear two-factor enrollment" and "Require password change at next sign-in", passed through the extended set_user_password (now remove_two_factor / reset_next_login) to changeuserpass's removeMultiFactor / resetNextLogin. Clearing 2FA only exists on changeuserpass, so it rides the password reset rather than a standalone action.

Model / data

models::User now carries the raw siteadmin bitmap and list_users populates it so the checkbox can seed from it. Field names (realname, email, siteadmin, removeMultiFactor, resetNextLogin) were verified against the ControlIn::EditUser / ControlIn::ChangeUserPass serde definitions in vervain-server's user_session.rs.

Acceptance criteria

  • Real name, email, and site-admin flag are editable in the drawer and persist (visible after a reload)
  • The site-admin checkbox is disabled when editing yourself
  • Password reset can optionally clear 2FA and/or require a password change at next sign-in
  • Server errors surface inline in the drawer (each section renders its own ErrorText)
  • just check passes

🤖 Generated with Claude Code

Resolves VAPP-21. ## What Extends the Users edit drawer (`src/components/pages/users.rs`) so admins can manage an account after creation, beyond the existing password reset and mesh membership. ### Account section (new) Real name input, email input, and a "Site administrator (full rights)" checkbox matching the create dialog's wording, seeded from the loaded `User` row. Save wraps a new `edit_user` server fn over vervain-server's `edituser` control action and refreshes the user list via the existing `on_changed` callback so the table reflects the new name / role. The site-admin checkbox is disabled when the target is the signed-in user, so an admin cannot strip their own rights mid-session. The new `get_current_user_id` server fn reads `userinfo._id` from the control-channel connect burst to make that comparison. ### Reset password section Gains two checkboxes, "Also clear two-factor enrollment" and "Require password change at next sign-in", passed through the extended `set_user_password` (now `remove_two_factor` / `reset_next_login`) to `changeuserpass`'s `removeMultiFactor` / `resetNextLogin`. Clearing 2FA only exists on `changeuserpass`, so it rides the password reset rather than a standalone action. ### Model / data `models::User` now carries the raw `siteadmin` bitmap and `list_users` populates it so the checkbox can seed from it. Field names (`realname`, `email`, `siteadmin`, `removeMultiFactor`, `resetNextLogin`) were verified against the `ControlIn::EditUser` / `ControlIn::ChangeUserPass` serde definitions in vervain-server's `user_session.rs`. ## Acceptance criteria - [x] Real name, email, and site-admin flag are editable in the drawer and persist (visible after a reload) - [x] The site-admin checkbox is disabled when editing yourself - [x] Password reset can optionally clear 2FA and/or require a password change at next sign-in - [x] Server errors surface inline in the drawer (each section renders its own `ErrorText`) - [x] `just check` passes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(users): edit profile, site-admin, clear 2FA, force password change
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 58s
42b3336cd9
Extend the Users edit drawer so admins can manage a user after creation, not just reset their password and meshes.

New Account section in the edit drawer: real name, email, and a "Site administrator (full rights)" checkbox seeded from the loaded row. Saving wraps a new `edit_user` server fn over vervain-server's `edituser` action and refreshes the user list. The site-admin checkbox is disabled when an admin edits their own account (a new `get_current_user_id` server fn reads the control-channel `userinfo._id`) so they cannot strip their own rights mid-session.

The reset-password section gains two checkboxes, "Also clear two-factor enrollment" and "Require password change at next sign-in", passed through `set_user_password` (now extended with `remove_two_factor` / `reset_next_login`) to `changeuserpass`'s `removeMultiFactor` / `resetNextLogin`. Clearing 2FA only runs through `changeuserpass`, so it rides the password reset rather than a standalone action.

`models::User` carries the raw `siteadmin` bitmap and `list_users` populates it so the checkbox can seed from it. Server errors surface inline in each section. `just check` passes.

#VAPP-21
Merge branch 'main' into feat/user-editing-vapp-21
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / fmt + clippy + build + tests (pull_request) Successful in 1m10s
40ba41103d
David merged commit c42bf2bc97 into main 2026-06-07 19:44:36 +02:00
David deleted branch feat/user-editing-vapp-21 2026-06-07 19:44:36 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/vervain-apps!26
No description provided.