diff --git a/apps/frontend/AGENTS.md b/apps/frontend/AGENTS.md index 98d714d8..5147c6a7 100644 --- a/apps/frontend/AGENTS.md +++ b/apps/frontend/AGENTS.md @@ -64,9 +64,9 @@ Import direction is one-way and must stay that way: `api.ts` ← `authClient.ts` **Refresh.** Access tokens last one hour. `AuthProvider` schedules a refresh ~2 minutes before expiry, and `authedFetch` refreshes reactively on a 401. Refresh is single-flight, so a burst of concurrent 401s produces one `POST /auth/refresh`. Cognito does not re-issue a refresh token, so `saveTokens` leaves the stored one alone when the response omits it. -**Guarding.** `src/app/components/AuthGate.tsx`, mounted once in `providers.tsx`, is the app's only route guard — static export means `middleware.ts` would never run. `src/lib/routes.ts` classifies routes and is **protected-by-default**: a new page under `src/app/` is guarded without opting in. Public routes are `/login`, `/forgot-password`, `/reset-password` (authenticated users get bounced off them). Open routes (`/help/**`) render for everyone, signed in or not, and skip the Chakra/Auth shell in `providers.tsx`: they are prerendered with real content, and Chakra's Emotion styles inline into SSR HTML and break hydration. +**Guarding.** `src/app/components/AuthGate.tsx`, mounted once in `providers.tsx`, is the app's only route guard — static export means `middleware.ts` would never run. `src/lib/routes.ts` classifies routes and is **protected-by-default**: a new page under `src/app/` is guarded without opting in. Public routes are `/login`, `/forgot-password`, `/reset-password` (authenticated users get bounced off them). Open routes (`/help/**`) render for everyone, signed in or not, and skip the Chakra/Auth shell in `providers.tsx`: they are prerendered with real content, and Chakra's Emotion styles inline into SSR HTML and break hydration. Which permission a page needs comes from `PAGE_PERMISSIONS` in `@branch/rbac`, so AuthGate, the Navbar and the lambdas all read one table. Always compare paths through `normalizePath` — `trailingSlash: true` means production sees `/login/` where dev and tests see `/login`. The public auth pages (`/login`, `/forgot-password`, `/reset-password`) share one layout: a `min-h-screen` centered wrapper around a `w-80` column; copy it for any new one. -**Help pages.** `/help` is the user guide, served at `branchaccounting.org/help`. Guides are data in `src/app/help/guides.ts` (numbered one-line steps; `[label](/path)` makes a link) and `[slug]/page.tsx` prerenders one page per guide via `generateStaticParams`. Screenshots live in `public/help//`; `test/app/HelpGuides.test.ts` fails on a missing image or a link to a page that does not exist. Retake screenshots against a local stack with seeded demo data, never production. Which permission a page needs comes from `PAGE_PERMISSIONS` in `@branch/rbac`, so AuthGate, the Navbar and the lambdas all read one table. Always compare paths through `normalizePath` — `trailingSlash: true` means production sees `/login/` where dev and tests see `/login`. +**Help pages.** `/help` is the user guide, served at `branchaccounting.org/help`. Guides are data in `src/app/help/guides.ts` (numbered one-line steps; `[label](/path)` makes a link) and `[slug]/page.tsx` prerenders one page per guide via `generateStaticParams`. Screenshots live in `public/help//`; `test/app/HelpGuides.test.ts` fails on a missing image or a link to a page that does not exist. Retake screenshots against a local stack with seeded demo data, never production. ## Permissions diff --git a/apps/frontend/public/help/reset-password/forgot-link.png b/apps/frontend/public/help/reset-password/forgot-link.png index 3955d252..722594fd 100644 Binary files a/apps/frontend/public/help/reset-password/forgot-link.png and b/apps/frontend/public/help/reset-password/forgot-link.png differ diff --git a/apps/frontend/public/help/reset-password/new-password.png b/apps/frontend/public/help/reset-password/new-password.png new file mode 100644 index 00000000..41281d76 Binary files /dev/null and b/apps/frontend/public/help/reset-password/new-password.png differ diff --git a/apps/frontend/public/help/reset-password/request-code.png b/apps/frontend/public/help/reset-password/request-code.png index 685c6e76..fe32fc30 100644 Binary files a/apps/frontend/public/help/reset-password/request-code.png and b/apps/frontend/public/help/reset-password/request-code.png differ diff --git a/apps/frontend/public/help/sign-in/login.png b/apps/frontend/public/help/sign-in/login.png index 0ddbdfe5..59293ac7 100644 Binary files a/apps/frontend/public/help/sign-in/login.png and b/apps/frontend/public/help/sign-in/login.png differ diff --git a/apps/frontend/src/app/forgot-password/page.tsx b/apps/frontend/src/app/forgot-password/page.tsx index 873bd931..c70cdf09 100644 --- a/apps/frontend/src/app/forgot-password/page.tsx +++ b/apps/frontend/src/app/forgot-password/page.tsx @@ -70,81 +70,92 @@ export default function ForgotPasswordPage() { if (step === 'done') { return ( -
-
-

Password Changed

-
+
+
+

Password Changed

+
Your password has been successfully changed!
+ + Back to login +
- - Back to login -
); } if (step === 'confirm') { return ( -
-
- We sent a verification code to {email}. Enter it below with your new password. -
- - - - Back to login - +
+
+
+ We sent a verification code to {email}. Enter it below with your new password. +
+ + + + Back to login + +
); } return ( -
-
-

- Forgot your Password? +
+
{ + e.preventDefault(); + handleRequestReset(); + }} + className="flex flex-col items-center text-center w-80" + > +

+ Forgot password?

-
- Please enter the email address you'd like your password reset information sent to +
+ Enter your email and we'll send you a code to reset your password.
-
-
- setEmail(value)} - /> +
+ setEmail(value)} + type="email" + name="email" + autoComplete="username" + /> +
- + Back to login -
+

); } diff --git a/apps/frontend/src/app/help/guides.ts b/apps/frontend/src/app/help/guides.ts index 38947015..88f04722 100644 --- a/apps/frontend/src/app/help/guides.ts +++ b/apps/frontend/src/app/help/guides.ts @@ -56,8 +56,11 @@ export const GUIDES: Guide[] = [ image: '/help/reset-password/request-code.png', alt: 'Forgot password page with Request reset code highlighted', }, - { text: 'Enter the code from your email and a new password.' }, - { text: 'Click Reset Password.' }, + { + text: 'Enter the code from your email and a new password, then click Reset Password.', + image: '/help/reset-password/new-password.png', + alt: 'Reset password form with Reset Password highlighted', + }, ], }, { diff --git a/apps/frontend/src/app/reset-password/page.tsx b/apps/frontend/src/app/reset-password/page.tsx index 9e592f2a..f5fe7074 100644 --- a/apps/frontend/src/app/reset-password/page.tsx +++ b/apps/frontend/src/app/reset-password/page.tsx @@ -43,7 +43,8 @@ function ResetPasswordContent() { // strings would just produce a confusing server-side error. if (!email || !code) { return ( -
+
+

Link expired

@@ -58,34 +59,37 @@ function ResetPasswordContent() { Request a new reset link
+
); } if (submitted) { return ( -
-
-

Password Changed

-
- Your password has been successfully changed! -
-
+
+
+

Password Changed

+
+ Your password has been successfully changed! +
+
); } return ( - +
+ +
); }