Files
ever-gauzy/apps
Ruslan KonviserandClaude Opus 5.5 c12fc11a50 fix(auth): make email verification work end to end and stop register dead-ends (#10332)
* fix(auth): make email verification work end to end and stop register dead-ends

Verification link and notice
- /auth/confirm-email no longer sits behind NoAuthGuard. Registering signs the
  user in, so the emailed link was opened by a signed-in user, redirected to the
  dashboard before the resolver ran, and never verified anything. The token is
  still required and still single use (the API clears it on success).
- A refused or expired link now shows its message instead of an endless spinner,
  and a successful one marks the signed-in user verified in the store.
- New "verify your email" notice with Resend (POST /auth/email/verify/resend-link,
  already throttled 3/min) in the main layout and on tenant onboarding. It shows
  only when GET /auth/email/verify/status (new, same feature flag, so 404 where
  verification is off) confirms the user is unverified.
- Settings > Billing: an unverified admin with no linked subscription is told a
  paid plan connects once the address is verified.

Email sending
- Templates fall back to English when the recipient's locale has none, instead
  of rendering an empty email (verification exists only in en/bg/he/ru).
- Send failures are logged with the provider code, SMTP reply code and command,
  every address masked; verification sends are now recorded in email_sent with
  status SENT/FAILED (subject only, never the link). A transport that fails
  verification throws instead of returning undefined.
- resend-link answers 503 when the provider refused the message, not "OK".
- The verification link encodes the address (plus-addressing survived as a space).
- A caller-supplied appEmailConfirmationUrl is honoured only on an origin this
  deployment serves (CLIENT_BASE_URL, the configured links, EMAIL_LINK_ALLOWED_ORIGINS;
  "*" disables the check).
- Auth emails carry X-PM-TrackLinks: None so Postmark stops storing tokens as clicks.
- {{appLink}} falls back to CLIENT_BASE_URL when APP_LINK is empty: every
  hosted deployment has APP_LINK empty, so welcome emails linked to localhost:4200.

Register
- A refused sign-up shows the API's 4xx message (e.g. "A subscription is
  required...") instead of "Something went wrong", and the 403 checkoutUrl is
  offered as a "Continue to checkout" button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(auth): confirm-email trusts the API, not the link, for who was verified

Review follow-ups on the confirm-email page:
- After a successful confirmation, re-read GET /auth/email/verify/status
  instead of comparing the link's email parameter with the signed-in user.
  The token decides which account was confirmed; the email parameter is not
  bound to it.
- A request that got no HTTP answer (status 0) is shown as a connection
  problem, not as an invalid link.
- ActivatedRoute, Store and AuthService come from inject().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(auth): apply a verification status only to the user it was asked for

If a different user signs in while the status or resend request is in flight,
the answer no longer updates the new user's verification state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ui-core): drop a resend answer once another user has signed in

The verification notice now tracks the user it speaks for. A different user
signing in cancels the pending resend and resets its state, and a late answer
for the previous user changes nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ui-core): a dismissed verification notice stays dismissed only for that user

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 12:32:46 +02:00
..
2026-04-01 23:49:57 +02:00
2026-02-20 09:52:34 +01:00