Add hotel team invitations, assisted account recovery and onboarding

This commit is contained in:
wolf-demon
2026-09-15 17:08:13 +01:00
parent 5a93c35b18
commit 7fcf51c900
14 changed files with 377 additions and 18 deletions
+44
View File
@@ -0,0 +1,44 @@
# Team access and hotel setup
Owners manage colleagues in **Your team**. The **Hotel setup** page shows progress derived from the hotel's saved MongoDB settings, approved answers, mailbox synchronization and active staff accounts. It does not enable any external action. Preview accounts and progress are temporary.
## Invite and recover staff
1. Enter the colleague's name and work email in Your team and create an invitation link.
2. Verify the intended recipient and share the link privately through your established workplace channel. GuestOps does **not** email the link. The link grants access to set that account's password; treat it as a temporary credential.
3. The colleague opens the link, chooses and confirms a unique password of 14–128 characters, then signs in normally. Staff cannot manage hotel controls or team accounts.
Invitations expire after 48 hours. **Reset password** issues a 30-minute link for an active staff account. The current password and sessions continue to work until the reset is accepted; then previous sessions are invalidated on their next request. **Revoke link** invalidates an outstanding link without changing an active account's password. Issuing another link replaces the previous one.
**Disable access** invalidates existing sessions and outstanding links. **Restore access** issues a 48-hour link that requires a new password before the disabled account becomes active. It does not restore access using the old password. Owner accounts cannot be disabled or recovered through staff controls.
An email belongs to one hotel account. Existing active accounts cannot be reassigned through an invitation. The 50-account pilot limit is a best-effort administrative limit, not an atomic quota. Roles in this release are Owner and Staff; granular roles, per-user preferences, MFA, public registration and self-service email recovery are future work.
## Owner recovery on the Linux server
The server administrator must verify the owner's identity before issuing a recovery link. On the server, in the directory containing the deployed Compose file and its private environment file:
```sh
read -r -p 'Verified owner email: ' RECOVERY_EMAIL
export RECOVERY_EMAIL
docker compose run --rm --no-deps -e RECOVERY_EMAIL api --recover-owner
unset RECOVERY_EMAIL
```
The command uses the configured database, generates a private link, prints it to the administrator's terminal and exits. Share it only with the verified owner. Do not paste it into tickets, chat logs, build logs or source control; avoid running this command in a recorded terminal. It expires in 30 minutes and can be consumed once. Running the command again invalidates the earlier link. Bootstrap remains a create-only command and cannot reset passwords.
`PublicUrl` must be the configured HTTPS origin, normally `https://sandbox-guestops.futuresens.co.uk`. Request Host headers never determine recovery-link origins. The Development-only preview uses `http://127.0.0.1:5173`.
## Storage and session behavior
MongoDB stores the SHA-256 hash of a random 256-bit token, its purpose and expiry. The raw token is returned only when issuing the link. Expiry is checked during inspection and again during atomic acceptance. Account records are not TTL-deleted when a link expires. Password hashing, version checks and a new security stamp prevent concurrent reuse and invalidate older sessions. Existing pre-migration accounts default to an empty stamp; their cookies remain valid until reset, disablement or normal expiry.
Tokens travel in URL fragments and are removed from browser history as the account page opens; submission uses POST with CSRF validation. API responses are not cached and referrer policy is `no-referrer`. The frontend holds the token only in component memory. Reloading after the fragment was removed requires reopening the original link. No analytics or third-party scripts are included on this page.
Account endpoints have rate limits. Because the reverse proxy currently forwards HTTPS status but not client IP addresses, anonymous recovery limits are shared behind that proxy. This can temporarily limit concurrent users; per-client limiting requires a separately reviewed trusted-proxy configuration.
Account changes appear in workspace activity without links, password hashes or tokens. Automated notification emails are not implemented, including password-change alerts. Recovery is an administrator-assisted process until verified transactional email is added. This is not a claim of production identity-provider completeness.
## Acceptance
Automated tests cover invitation/recovery acceptance, concurrent single-use enforcement with real MongoDB, expiry, reissue/revocation, session invalidation, staff restrictions, owner protection, cross-hotel access, configured origins and secret-free API views. Before inviting real staff, verify the deployed HTTPS link, private handoff process, owner recovery command and backup/restore procedure with test accounts.
+7 -2
View File
@@ -12,7 +12,7 @@ Local JSON stores and process mutexes are not reused in production. MongoDB enfo
The UI is an operational inbox rather than a port of the desktop booking grid. Real installations start empty. The sample hotel exists only in explicitly enabled Development preview mode. The preview banner remains visible at compact widths.
Authentication uses ASP.NET cookie protection and its password hasher. Sessions expire after eight hours and validate the user's active status and role on each request. Owner provisioning is an administrator CLI operation; no staff invitation or self-service recovery flow is claimed yet. A staff-facing pilot should not expand beyond administrator-supported accounts until those flows are added.
Authentication uses ASP.NET cookie protection and its password hasher. Sessions expire after eight hours and validate the user's active status and role on each request. Owner provisioning remains an administrator CLI operation. Milestone 6 adds owner-issued staff invitations and assisted account recovery; transactional email recovery remains future work.
Gmail permissions are read-only. The worker fetches plain-text bodies and skips automated/list/bounce messages. It does not fetch attachments, mark messages read, delete them, send mail, or call a PMS. Initial import is seven days, 25 messages per worker cycle. Unfinished pages retain their checkpoint, and overlap between synchronization windows is deduplicated. Invalid provider pagination tokens currently require operator reconnection/reset of the mailbox checkpoint; there is no full history-repair UI yet.
@@ -32,10 +32,14 @@ Implemented owner-reviewed invoice creation, unique payment references, customer
Implemented seven exact FAQ question rules, approved-answer version binding, test/live modes, durable daily quotas, Gmail thread rechecks and staff handover for rejected automatic replies. Plain-text messages only; broad natural-language matching is not claimed. Live Gmail and rule acceptance remains pending. See [automation setup and limits](auto-replies.md).
## Milestone 6: team accounts and hotel onboarding
Implemented owner-issued single-use invitation and recovery links, staff disable/restore controls, session invalidation after password changes, server-admin owner recovery and a setup checklist derived from saved hotel state. Links are copied and shared privately; GuestOps does not send recovery emails. See [account setup and limits](accounts.md).
## Remaining milestones
1. Test Google connection with a dedicated test mailbox; add provider fixture tests, disconnect/revocation, refresh failure recovery and full thread aggregation.
2. Add staff invitations, account recovery, granular roles, user preferences and an onboarding wizard.
2. Add verified transactional email for invitations and recovery notifications, MFA, granular roles and user preferences.
3. Run a representative live AI draft evaluation, improve retrieval and evidence presentation, and approve the selected provider data-processing arrangements.
4. Extend the implemented durable reply queue with operator recovery tooling and broaden the controlled FAQ rules only after live acceptance. Preserve the rule that uncertain sends are never blindly replayed.
5. Validate the OHIP adapter against the property sandbox, extend supported PMS operations and validate NMI hosted invoices with the merchant sandbox. Add direct payment URLs only when a supported provider contract is available. Do not enable these by merely copying desktop settings or toggling a feature flag.
@@ -47,3 +51,4 @@ Windows DPAPI settings must not be copied to Linux as usable credentials. Re-ent
Target supplied by the owner: Debian 12, 4 CPU cores, 7.6 GiB RAM, 18 GiB free disk; MongoDB on the same machine. Compose includes conservative starting memory limits and capped logs, not a capacity guarantee. Keep database/key backups off-server and do not import entire mailboxes by default. Establish retention and restore testing before real guest data is used.