Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
4.2 KiB
4.2 KiB
Tasks
Design: design.md. All tasks run serially: each builds on the one before.
1. Backend
-
1.1 Secure generator (design decision 1).
ValidateUtil.getRandomPasswordStringdraws from a staticSecureRandomwith the same alphabet.Tests first:
- the length matches the argument;
- every character is in the alphabet;
- 1,000 calls of length 12 are all distinct.
Then show by reading the code that no
java.util.Randomremains in that method.- Scope:
solvway-core-libs/src/**/ValidateUtil* - Verify:
mvn -T 1C -B -q -pl solvway-core-libs verify
-
1.2 services-system endpoints (design decision 2):
/user/validatePasswordFromRulesForAdminand/user/setAdminPassword.Tests first:
- validate returns the failing
ADMIN_PWD_FORMATrules, and an empty list for a passing password; - set stores a bcrypt hash that matches the password, with
login = N, for an enabled type-A user; - set returns 0 and saves nothing for a disabled, unknown or non-admin user, or a password that fails the rules;
- no email is sent.
- Scope:
solvway-services-system/src/**(user controller, service and tests) - Verify:
mvn -T 1C -B -q -pl solvway-services-system -am verify
- validate returns the failing
-
1.3 mobile-api create and set password (design decisions 3 and 4).
Tests first:
- create:
- missing password gives 400
REQUIRED_FIELD; - a mismatch gives 400
PASSWORD_MISMATCH; - a rules failure gives 400
PASSWORD_POLICY; - in all three cases no user is saved;
- success saves the user, calls
setAdminPasswordand sends no email; setAdminPasswordreturning 0 gives 500SAVE_FAILED.
- missing password gives 400
POST /api/admin/users/{id}/password:- success gives 204;
- own account gives 400
SELF_NOT_ALLOWED; - a super admin target with a non-super caller gives 403;
- a disabled target gives 409
USER_DISABLED; - an unknown target gives 404;
- a mismatch gives
PASSWORD_MISMATCH, and a rules failure givesPASSWORD_POLICY; - without
BO_USERSthe call is refused; - the audit log line does not contain the password.
Live check through the gateway, on a made-up local user:
- create the user with a password;
- sign in with it and get 403
PASSWORD_RESET_REQUIRED; - complete first-login;
- set a temporary password;
- check the old password now fails.
- Scope:
solvway-mobile-api/src/**(admin user files,AdminUserRequestand tests) - Verify:
mvn -T 1C -B -q -pl solvway-services-system,solvway-mobile-api -am verify
- create:
2. Portal
-
2.1 Password fields on
/users/newand "Set temporary password" on/users/[id](design decision 5): a proxy route, a service function and i18n keys.Tests first:
- create:
- the form sends
passwordandconfirmPassword; - a mismatch is caught before submitting;
PASSWORD_POLICYshows its message.
- the form sends
- edit:
- the set-password form calls the service;
- success clears both fields and shows the confirmation;
- each refusal code shows its message;
- the form is hidden on the caller's own account.
- Scope:
solvway-admin-portal/app/users/**,solvway-admin-portal/app/api/users/**,solvway-admin-portal/app/lib/**, i18n files - Verify:
cd solvway-admin-portal && npx vitest run && npx tsc --noEmit && npm run lint && npm run build
- create:
3. Check and docs
- 3.1 Browser check and handover.
- Playwright on the local stack, as admin:
- create a made-up user with a password;
- sign in as that user in a second session and get sent to the password change;
- change the password and reach the app;
- back as admin, set a temporary password for that user;
- sign in with it and get sent to the password change again;
- check the old password fails.
- Refusals, each with its message shown:
- a weak password on create;
- a mismatch on create;
- a deactivated user;
- Own account: the set-password form is not shown.
- Phone width: check both forms at 360px.
- Docs: update
docs/deployment.mdsections 2 (step 6) and 10. - Scope:
docs/deployment.md - Verify: screenshots, and the steps above observed.
- Playwright on the local stack, as admin:
Workflow follow-up
- Whole-branch review, push, PR to main and merge, then archive on its own branch.