docs(openspec): rework add-admin-temporary-password to the legacy admin-set password flow
The admin types the initial password on create and a temporary password on edit; the user is saved with login = N and must change it at first sign-in. No email is needed to onboard staff. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
7c0a34508e
commit
b49c9f1bc3
4 files changed
+185
-98
No files matched your search
@@ -4,20 +4,24 @@
|
||||
|
||||
Staff can only get a first password by email. Creating a user emails a temporary password, and so does the admin reset; an admin cannot set a password themselves. No email provider will be configured for go-live on 2027-01-15, so only the first administrator could ever sign in, and staff could not key in leads at the event.
|
||||
|
||||
The shared generator behind those temporary passwords also uses `java.util.Random`, which is predictable.
|
||||
The legacy Tastefully backoffice did not depend on email here. The admin typed the new user's password (Password and Confirm Password on the create form), the user was saved with `login = N`, and the user had to change the password at first sign-in. Co-Lite follows that flow.
|
||||
|
||||
The shared generator behind the emailed temporary passwords also uses `java.util.Random`, which is predictable.
|
||||
|
||||
## What Changes
|
||||
|
||||
- **Set temporary password**: an admin with `BO_USERS` can generate a temporary password for another active user from the user's edit page.
|
||||
- The system picks the password (12 characters) and shows it to the admin once, with a copy button. The admin passes it to the staff member.
|
||||
- The user's old password stops working, and the user must choose a new password at the next sign-in, as after any reset.
|
||||
- The admin never chooses the value, so the existing rule that an admin cannot set another user's password to a value of their choice stays.
|
||||
- The same guards as the existing reset apply: no disabled users, no super admin unless the caller is one. A caller cannot use it on their own account.
|
||||
- The password is never stored, cached or logged unhashed. The response is marked `no-store`.
|
||||
- **Secure generator**: the shared temporary-password generator uses `SecureRandom`. This also covers the emailed reset, forgot-password and the password emailed at user creation.
|
||||
- Creating a user is unchanged: it still tries to email a temporary password. Without email, the admin opens the new user and sets a temporary password.
|
||||
- **Create user (BREAKING for the create API):** the create form gets Password and Confirm Password. The admin types the initial password.
|
||||
- The password must match its confirmation and pass the admin password rules (the same rules as the first-login change).
|
||||
- The user is saved with `login = N`, so they must choose a new password at first sign-in.
|
||||
- No email is sent at create. `TEMP_PASSWORD_NOT_SENT` goes away.
|
||||
- **Set temporary password:** the user edit page gets a "Set temporary password" action with Password and Confirm Password.
|
||||
- The admin types a temporary password for another active user. The old password stops working, and `login = N` is set.
|
||||
- Refused for a disabled user, for the caller's own account, and for a super admin when the caller is not one.
|
||||
- **Emailed reset stays** for when email is configured later.
|
||||
- Passwords are never logged or returned. They travel only in the request body, which the gateway does not log.
|
||||
- **Secure generator:** the shared temporary-password generator uses `SecureRandom`. This covers the emailed admin reset and forgot-password.
|
||||
|
||||
Not in this change: a "show instead of email" option on the create form, and configuring an email provider.
|
||||
Not in this change: configuring an email provider, or ending the user's existing sessions when an admin sets a password.
|
||||
|
||||
## Capabilities
|
||||
|
||||
@@ -25,12 +29,18 @@ Not in this change: a "show instead of email" option on the create form, and con
|
||||
None.
|
||||
|
||||
### Modified Capabilities
|
||||
- `admin-users`: three new requirements: a temporary password shown to the admin, its refusals, and secure generation of every temporary password. The existing "Admin-triggered password reset" requirement is unchanged, including its rule against admin-chosen passwords.
|
||||
- `admin-users`:
|
||||
- "Create user" changes: the admin sets the initial password, and nothing is emailed.
|
||||
- "Admin-triggered password reset" changes: an admin may set a temporary password, always with a forced change at next sign-in. The rule against admin-chosen passwords is dropped.
|
||||
- New requirements: refusals for setting a temporary password, and secure generation of emailed temporary passwords.
|
||||
|
||||
## Impact
|
||||
|
||||
- `solvway-core-libs`: `ValidateUtil.getRandomPasswordString` uses `SecureRandom`.
|
||||
- `solvway-services-system`: a new internal endpoint sets a generated temporary password and returns it once.
|
||||
- `solvway-mobile-api`: `POST /api/admin/users/{id}/temporary-password` under `BO_USERS`.
|
||||
- `solvway-admin-portal`: a "Set temporary password" action and a show-once dialog on the user edit page, a proxy route, a service and i18n keys.
|
||||
- No database or dependency change. `docs/deployment.md` section 10 is updated: staff can now be onboarded without email.
|
||||
- `solvway-services-system`: two internal endpoints. One checks a password against the admin rules. The other stores an admin-set password, bcrypt-encoded, with `login = N`.
|
||||
- `solvway-mobile-api`:
|
||||
- `POST /api/admin/users` takes `password` and `confirmPassword`;
|
||||
- new `POST /api/admin/users/{id}/password`, under `BO_USERS`.
|
||||
- `solvway-admin-portal`: password fields on `/users/new`, a set-password form on `/users/[id]`, a proxy route, a service function and i18n keys.
|
||||
- No database or dependency change.
|
||||
- `docs/deployment.md` sections 2 and 10: staff are onboarded without email.
|
||||
Reference in new issue
Block a user