Commit Graph
5 Commits
Author SHA1 Message Date
petriandClaude Sonnet 5.5 32c33e2a64 Give the machine console its own session with PIN sign-in, make counters cumulative
The console under console/ has its own session cookie and console guard
(UseConsoleSession), so signing out or changing user there leaves the
normal interface alone. Links open it in a new window through a one-time
handoff key; a signed-out console asks for a PIN code or password on its
own login page. Users set their 4-6 digit PIN on the profile's PIN page,
and the console's change user dialog takes it on a keypad; five wrong
PINs lock PIN sign-in for 15 minutes.

Machine counters are cumulative: users record how much a job used and it
is added to the latest reading. A maintenance record restarts the whole
counter interval from the reading at the record.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-29 09:58:11 +02:00
petriandClaude Opus 5.5 45dbb04344 Keep the chosen language across sign-in and forced sign-out
A language picked on a signed-out page is now stored on the account when
the user signs in (StoreLocaleChosenBeforeLogin), so the app does not
switch back to the account default. EnsureAccountIsUsable keeps the user's
language for the login page when it ends a disabled account's session.

ChangePreferredLocale runs in a transaction like the other use cases, the
language names come from layout.languages instead of the Locale enum, and
the translation test also compares fi.json with en.json and rejects
English files without a Finnish counterpart.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 07:09:22 +02:00
petriandClaude Opus 5.5 8aead06972 Add English to the UI and a profile menu for language and theme
Every UI string now exists in lang/fi and lang/en; a unit test checks that
both languages have the same keys and placeholders. A user's language is
stored on the account (users.locale) and applied by the SetLocale web
middleware, falling back to the session's choice on signed-out pages and
then APP_LOCALE. Emails use the user's language through
HasLocalePreference, and the login page keeps the language after logout.

The header's name, theme toggle and logout button become one profile menu
(a disclosure) with the language buttons, light/dark/system theme radios
kept on the device, and logging out. Signed-out pages get a Suomi/English
switch next to the theme toggle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 06:28:39 +02:00
petriandClaude Opus 5.5 c9a7f970ab Fix review findings in login and user management
- Load stored users without re-checking role rules, so an intern whose
  supervisor was deleted no longer gets a 500 on every request; the
  rules apply again on the next change.
- Refuse to deactivate or demote a supervisor of active interns
  (SupervisorHasInterns).
- Lock active admin rows in the last-admin check so concurrent changes
  cannot remove every admin.
- Creating a user survives mail failures: the error is reported and
  the admin is asked to resend the link (CreatedUserAccount result).
- Session-ended redirect passes the reason in the URL
  (/login?access=ended), so Livewire requests also show it.
- Same login message for a wrong password and a disabled account.
- Forgot-password sends links only to users who may sign in today
  (RequestPasswordReset), with the same neutral message.
- Use the default callout instead of the low-contrast warning variant.
- Document make:class/make:test for module files in CLAUDE.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-22 11:18:22 +02:00
petriandClaude Opus 5.5 8c7cb9e3b4 Add login, password reset and user management (Users module)
New Users module with the four layers:
- Domain: Role enum, UserAccount entity (intern needs end date and
  supervisor, login allowed until the end of the last day), email and
  name value objects, SupervisorRule, last-admin protection.
- Application: CreateUserAccount (emails a set-password link),
  UpdateUserAccount, SendPasswordSetupLink, CheckLoginAllowed, query
  contract and Clock (business time zone Europe/Helsinki).
- Infrastructure: users table gets role, is_active, employment_ends_on
  and supervisor_id; Eloquent repository and queries; Password broker
  link sender with a Finnish email; Gate users.manage.
- Presentation: Livewire login (rate limited), forgot and reset
  password pages, logout, EnsureAccountIsUsable middleware that ends
  sessions of deactivated users, admin-only user list and form, and
  users:create-admin command.

Also:
- Layout gets a labelled main menu, the signed-in user and logout.
- Remove the local /dev/login; guests are redirected to /login.
- Customers: customers.use ability (no subcontractors), authorization
  in mount and save, locked customerId, 404 for a missing customer,
  empty-state check uses the total count.
- Architecture test lets module providers register their own
  Presentation classes; docs and CLAUDE.md updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-22 11:03:00 +02:00