Files
co-lite/openspec/specs/admin-own-password/spec.md

2.4 KiB

admin-own-password Specification

Purpose

Let a signed-in admin change their own password, checked against the current password and the admin password rules, without an administrator.

Requirements

Requirement: Change own password

The system SHALL let a signed-in admin change their own password by giving the current password, a new password and its confirmation. The new password SHALL pass the admin password rules and SHALL differ from the current one. On success the system SHALL keep the admin signed in, keep their first-login state complete, and record PASSWORD_CHANGED. An admin whose first-login password change is still pending SHALL use the first-login flow instead.

Scenario: Successful change

  • WHEN sales1 gives the right current password and a new password that passes the rules, twice
  • THEN the new password works at the next sign-in and the old one does not
  • AND sales1 stays signed in
  • AND a PASSWORD_CHANGED record is saved

Scenario: Confirmation differs

  • WHEN the new password and its confirmation differ
  • THEN the change is refused with PASSWORD_MISMATCH

Scenario: Same as current

  • WHEN the new password equals the current password
  • THEN the change is refused with PASSWORD_SAME

Scenario: Fails the rules

  • WHEN the new password breaks an admin password rule
  • THEN the change is refused with PASSWORD_POLICY

Scenario: Pending first login

  • GIVEN sales1 must still complete the first-login password change
  • WHEN sales1 calls change password
  • THEN the request is refused and sales1 is sent to the first-login flow

Requirement: Wrong current password counts as a failed sign-in

The system SHALL refuse a change whose current password is wrong with CURRENT_PASSWORD_WRONG, and SHALL record it as LOGIN_FAIL so that repeated wrong guesses lock the username. A locked username SHALL be refused with ACCOUNT_LOCKED before the current password is checked.

Scenario: Wrong current password

  • WHEN sales1 gives a wrong current password
  • THEN the change is refused with CURRENT_PASSWORD_WRONG
  • AND a LOGIN_FAIL record for sales1 is saved

Scenario: Locked while changing

  • GIVEN sales1 is locked
  • WHEN sales1 calls change password with the right current password
  • THEN the change is refused with ACCOUNT_LOCKED
  • AND the password is unchanged