Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
2.2 KiB
2.2 KiB
MODIFIED Requirements
Requirement: Staff login
The system SHALL let an active admin user log in through the admin portal with company code, username and password, or with username and password and no company for a super admin, and SHALL return the user's name, roles, company, menu and whether a password change is required. When a login fails and the company field was left empty, the login page SHALL also say that staff sign in with their company code, decided from the form alone so that it never reveals whether the username exists.
Scenario: Correct credentials
- GIVEN an active admin user
sales1of active companyins - WHEN they submit company
ins, usernamesales1and their password on the login page - THEN they are signed in and land on the portal home
- AND the sidebar shows only the menu entries their roles grant
Scenario: Super admin
- GIVEN the super admin
admin, who belongs to no company - WHEN they submit username
adminand their password with the company left empty - THEN they are signed in
Scenario: Wrong password
- WHEN a user submits a wrong password
- THEN
/api/admin/auth/loginresponds 401 - AND the login page shows an invalid-credentials message without saying whether the company or username exists
Scenario: Staff user without company
- GIVEN an active admin user
sales1of companyins - WHEN they submit username
sales1and their correct password with the company left empty - THEN login is refused with a 401
- AND the page shows the invalid-credentials message and that staff sign in with their company code
Scenario: Unknown username without company
- WHEN someone submits a username that does not exist with the company left empty
- THEN the page shows exactly the same messages as for
sales1without a company
Scenario: Deactivated user
- GIVEN an admin user whose account is deactivated
- WHEN they submit their correct password
- THEN login is refused with a 401 and the page shows the same invalid-credentials message
Scenario: Member account
- WHEN a member (non-admin) account submits its correct credentials to the admin login
- THEN login is refused with a 401