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
@@ -1,24 +1,59 @@
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: Create user
|
||||
|
||||
The system SHALL let an admin with `BO_USERS` create an admin user with name, username, email, one or more roles, and an initial password with its confirmation. Username and email SHALL be unique. The password SHALL match its confirmation and pass the admin password rules. The new user SHALL be saved with a pending password change, SHALL belong to the creating admin's company, and SHALL NOT be sent an email.
|
||||
|
||||
#### Scenario: New user
|
||||
|
||||
- **WHEN** an admin creates user `sales1` with email `sales1@example.com`, role Sales and a valid initial password
|
||||
- **THEN** the user is saved as active with a pending password change
|
||||
- **AND** `sales1` can sign in with that password and must choose a new password before anything else
|
||||
- **AND** no email is sent
|
||||
- **AND** the user's company is the creating admin's company
|
||||
|
||||
#### Scenario: Duplicate username
|
||||
|
||||
- **GIVEN** a user `sales1` exists
|
||||
- **WHEN** an admin creates another user with username `sales1`
|
||||
- **THEN** the save is refused and the form shows that the username is taken
|
||||
|
||||
#### Scenario: Weak or mismatched initial password
|
||||
|
||||
- **WHEN** an admin creates a user with a password that fails the admin password rules, or that does not match its confirmation
|
||||
- **THEN** the save is refused with a message on the form
|
||||
- **AND** no user is created
|
||||
|
||||
### Requirement: Admin-triggered password reset
|
||||
|
||||
The system SHALL let an admin with `BO_USERS` give another active user a new password in one of two ways: an emailed reset, where the system emails a generated temporary password, or a temporary password the admin types with its confirmation. Either way the user's old password SHALL stop working, and the user SHALL be required to change the password at the next login. A typed password SHALL pass the admin password rules. No password SHALL be logged or returned in a response.
|
||||
|
||||
#### Scenario: Reset
|
||||
|
||||
- **WHEN** an admin resets `sales1`'s password by email
|
||||
- **THEN** `sales1`'s old password stops working
|
||||
- **AND** a temporary password is emailed to `sales1`'s email address
|
||||
|
||||
#### Scenario: Admin sets a temporary password
|
||||
|
||||
- **GIVEN** an active user `sales1`
|
||||
- **WHEN** an admin sets a temporary password for `sales1` that passes the rules and matches its confirmation
|
||||
- **THEN** `sales1`'s old password stops working
|
||||
- **AND** `sales1` can sign in with the temporary password and must choose a new password before anything else
|
||||
|
||||
#### Scenario: Weak or mismatched temporary password
|
||||
|
||||
- **WHEN** an admin sets a temporary password that fails the admin password rules, or that does not match its confirmation
|
||||
- **THEN** the request is refused with a message
|
||||
- **AND** `sales1`'s password is unchanged
|
||||
|
||||
#### Scenario: No direct password set
|
||||
|
||||
- **WHEN** an admin calls `POST /api/admin/users/{id}/changePassword`
|
||||
- **THEN** the endpoint does not exist and no password changes
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Temporary password shown to the admin
|
||||
|
||||
The system SHALL let an admin with `BO_USERS` set a temporary password for another active user. The system generates it with a cryptographically secure random source, at least 12 characters long, and shows it to the admin once. The admin never chooses it. The user's old password SHALL stop working, and the user SHALL be required to change the password at the next login. The temporary password SHALL NOT be stored or logged unhashed, and the response carrying it SHALL NOT be cacheable.
|
||||
|
||||
#### Scenario: Temporary password shown to the admin
|
||||
|
||||
- **GIVEN** an active user `sales1` and no email provider
|
||||
- **WHEN** an admin sets a temporary password for `sales1`
|
||||
- **THEN** the admin sees a generated password of at least 12 characters once
|
||||
- **AND** `sales1`'s old password stops working
|
||||
- **AND** `sales1` can sign in with the shown password and must choose a new password before anything else
|
||||
|
||||
#### Scenario: Temporary password not shown again
|
||||
|
||||
- **GIVEN** an admin has set a temporary password for `sales1`
|
||||
- **WHEN** the admin reloads the user's page
|
||||
- **THEN** the password is not shown again
|
||||
- **AND** setting another one replaces it
|
||||
|
||||
### Requirement: Temporary password refusals
|
||||
|
||||
The system SHALL refuse to set a temporary password for a disabled user, for the caller's own account, and for a super admin when the caller is not a super admin, and SHALL leave that user's password unchanged.
|
||||
@@ -42,7 +77,7 @@ The system SHALL refuse to set a temporary password for a disabled user, for the
|
||||
|
||||
### Requirement: Generated temporary passwords are unpredictable
|
||||
|
||||
Every temporary password the system generates SHALL come from a cryptographically secure random source. This covers the emailed admin reset, forgot-password, the password emailed at user creation, and the password shown to the admin.
|
||||
Every temporary password the system generates SHALL come from a cryptographically secure random source. This covers the emailed admin reset and forgot-password.
|
||||
|
||||
#### Scenario: Generated passwords do not repeat
|
||||
|
||||
|
||||
Reference in new issue
Block a user