Files
co-lite/openspec/changes/add-admin-temporary-password/specs/admin-users/spec.md
T

2.5 KiB

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.

Scenario: Disabled user

  • GIVEN user sales2 is deactivated
  • WHEN an admin sets a temporary password for sales2
  • THEN the request is refused and sales2's password is unchanged

Scenario: Own account

  • WHEN an admin sets a temporary password for their own account
  • THEN the request is refused

Scenario: Super admin target

  • GIVEN the caller is not a super admin
  • WHEN they set a temporary password for a super admin
  • THEN the request is refused and the super admin's password is unchanged

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.

Scenario: Generated passwords do not repeat

  • WHEN the system generates 1,000 temporary passwords of 12 characters
  • THEN all of them are different
  • AND every character comes from the generator's alphabet