Commit graph

299 commits

Author SHA1 Message Date
Khalim Conn-Kowlessar
c921db7d9c initial implementation for portfolio invitations. A user can send an invitation to a user and they will receive an invitation email 2026-05-27 16:18:21 +00:00
Khalim Conn-Kowlessar
d042606955 Add 6-digit code sign-in as primary, magic link as fast-path fallback
Same email now contains a 6-digit code and a magic link, both backed by a
single verificationToken row. After submitting their email, the user
lands on /auth/verify-code with a single-input form (inputmode=numeric,
autocomplete=one-time-code, auto-submit on 6 digits or paste) and can
either type the code or use the link from the email. Either path
consumes the same row — single-use, replace-on-resend.

This is the structural fix for the silent-quarantine pattern observed
with Atkins and Sustainable Building UK: corporate gateways are happier
with short transactional content than long opaque token URLs, and a
code can't be broken by SafeLinks-style URL rewriting. The link path is
preserved so users whose email gets through unmangled keep one-click UX.

Security:
  - Codes are 6-digit, crypto.randomInt-generated, stored as sha256
    hashed against NEXTAUTH_SECRET on the same row as the link token
  - 5-attempt lockout per code (attempts column); 6th attempt with the
    correct code still fails
  - Per-email send rate limit: 5/hour fixed window (authRateLimits
    table); 6th send returns an error
  - Code + link share a 10-minute window (maxAge dropped from 1h)
  - Resending replaces any prior token rows for the identifier so only
    the latest send is ever live

Implementation:
  - verificationCode.ts holds generateCode + hashCode + the pure
    evaluateCodeAttempt decision tree; 9 unit tests cover every branch
    of the verification outcome (no-such-row, expired, locked-out, ok,
    wrong-with-newAttempts, locked-out-still-rejects-correct-code)
  - sendVerificationRequest now hashes the URL token the same way
    /verify/[token]/page.tsx does, applies the rate limit + records the
    code + replaces older rows in two transactions
  - CredentialsProvider (id: "email-code") calls evaluateCodeAttempt
    inside a transaction, handles all 5 outcomes, creates the user on
    first successful code (parity with the magic-link callback path)
  - oauthId backfill in the signIn callback is now guarded on
    account.type === "oauth" so the credentials flow doesn't pollute
    oauthProvider with "email-code"
  - Migration is additive: code_hash nullable, attempts default 0; new
    authRateLimits table is independent. In-flight tokens at deploy time
    keep working via the link path.

Vercel preview deployment is the test surface; a Mailpit + Cypress E2E
loop is intentionally deferred per the lean-setup plan in docs/wip/
auth-email-code-fallback-plan.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 14:16:47 +00:00
Jun-te Kim
f205524fe9 more hubspot deal data 2026-05-27 10:26:39 +00:00
Jun-te Kim
6c7c43fb89 roof 2026-05-26 16:07:26 +00:00
Jun-te Kim
35156111d0 built type 2026-05-26 15:04:02 +00:00
Jun-te Kim
9612b1fd4b new wall types 2026-05-26 14:32:57 +00:00
Jun-te Kim
1df047a84a landlord overrides 2026-05-26 10:21:50 +00:00
KhalimCK
20f6aff62e
Merge pull request #266 from Hestia-Homes/feature/pm-ui-ux
Some checks failed
Test Suite / unit-tests (push) Has been cancelled
Feature/pm UI ux
2026-05-18 10:00:40 +01:00
Daniel Roth
20648f30e0 add coordination_hub file source 2026-05-18 08:17:28 +00:00
Daniel Roth
452a2cd61d add new coordination and design file types 2026-05-13 13:51:02 +00:00
Daniel Roth
00b0cc2a45 add uploaded_file_id fk to magic_plan_plan 2026-05-13 10:03:07 +00:00
Jun-te Kim
6f9fabb622
Merge pull request #243 from Hestia-Homes/feature/onbarding_of_addresses
Some checks are pending
Test Suite / unit-tests (push) Waiting to run
Feature/onbarding of addresses
2026-05-12 18:26:40 +01:00
Jun-te Kim
10b3d81bc2 added enum from hubspot source 2026-05-12 16:18:42 +00:00
Daniel Roth
8f87ea0c96 magic_plan_uid column is unique 2026-05-12 15:41:43 +00:00
Daniel Roth
edcabea199 add magic plan file source and file type 2026-05-08 14:15:08 +00:00
Khalim Conn-Kowlessar
2468d3600b Merge branch 'main' of https://github.com/Hestia-Homes/assessment-model into feature/pm-ui-ux 2026-05-07 18:26:05 +00:00
Khalim Conn-Kowlessar
4357ae9802 add schema files and migration 0198 for magic_plan_uid 2026-05-07 18:13:17 +00:00
Khalim Conn-Kowlessar
5f0617b691 adding multi organisation connect 2026-05-07 12:32:20 +00:00
Khalim Conn-Kowlessar
a046ed4a5c working on pibi ui 2026-05-06 23:04:45 +00:00
Khalim Conn-Kowlessar
19139b6253 Updated survey request UI for Devon County Council 2026-05-06 20:37:30 +00:00
Jun-te Kim
4f43d32309 Merge remote-tracking branch 'origin' into feature/onbarding_of_addresses 2026-05-06 15:50:35 +00:00
KhalimCK
a456be3c54
Merge pull request #248 from Hestia-Homes/feature/additional-db-columns
added hubspot user table
2026-05-06 15:35:31 +01:00
Daniel Roth
64b7c27878 correct casing 2026-05-06 14:13:59 +00:00
Daniel Roth
09697884eb add postcode to plan 2026-05-06 14:03:00 +00:00
Daniel Roth
a1b086f18e indent 2026-05-06 13:58:51 +00:00
Daniel Roth
19df0e2cd5 indent 2026-05-06 13:58:12 +00:00
Daniel Roth
9f6eb888d9 correct casing 2026-05-06 13:57:49 +00:00
Daniel Roth
e85eabf89d correct column name in window 2026-05-06 13:56:54 +00:00
Daniel Roth
855cf2a10b change door width to mm 2026-05-06 13:56:46 +00:00
Daniel Roth
dd02b7f85d indent 2026-05-06 13:55:02 +00:00
Daniel Roth
d63cfe6828 rename magic plan plan plan_name to name 2026-05-06 13:54:29 +00:00
Daniel Roth
a8c5e7e923 add magicplan tables 2026-05-06 13:52:55 +00:00
Jun-te Kim
f98a740ee7 fix merge request 2026-05-06 09:47:53 +00:00
Khalim Conn-Kowlessar
4734eeed07 updating live tracking new features UI 2026-05-05 20:43:19 +00:00
Khalim Conn-Kowlessar
54e093891d add user_defined_deal_measures table migration and schema
Track instructed and pibi-ordered measures locally with a source enum,
created-by user, and HubSpot sync timestamps so issue #253 can persist
approver instructions and slice 4 can reuse the table for PIBI selections.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 18:56:09 +00:00
Khalim Conn-Kowlessar
73a365468a migrate domna_survey_required -> domna_survey_type
Drops the too-coarse boolean column and adds a free-text
`domna_survey_type` column on hubspot_deal_data so an approver can record
the survey kind directly. Updates the Drizzle schema, the HubspotDeal
type, and the live-tracking page mapping to expose the new column.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 18:37:38 +00:00
Khalim Conn-Kowlessar
0a6a01caaf added hubspot user table 2026-04-30 19:16:35 +00:00
Khalim Conn-Kowlessar
2957caf986 Added new fields to db 2026-04-30 14:34:39 +01:00
Daniel Roth
f7b35f04a8 make column unique 2026-04-28 16:11:33 +00:00
Daniel Roth
b696f823a4 add new fk column uploaded_file_id 2026-04-28 16:08:31 +00:00
Daniel Roth
593be49773 rename pvcFrame to frameMaterial and make nullable 2026-04-27 16:25:36 +00:00
Daniel Roth
e6e91f6278 make window transmissionDataSource text not integer 2026-04-27 14:37:12 +00:00
Jun-te Kim
c3cc123a6f save working progress 2026-04-24 15:57:30 +00:00
Daniel Roth
fead8582c6 make property_id and portfolio_id foreign keys nullable 2026-04-24 11:03:01 +00:00
Daniel Roth
bec81c986f address columns not null 2026-04-24 10:30:35 +00:00
Daniel Roth
a595f9482e revert previous commit 2026-04-24 10:29:23 +00:00
Daniel Roth
3014136e99 address columns notnull 2026-04-24 10:25:33 +00:00
Daniel Roth
cb59f435ad comments 2026-04-24 09:48:15 +00:00
Daniel Roth
62a31126a2 remove accidental duplicate epcpropertydetails table 2026-04-23 16:48:24 +00:00
Daniel Roth
fa38abfc8c Merge branch 'main' into feature/new-epc-tables 2026-04-23 16:25:05 +00:00