Add error state display for invalid credentials on login page

- Capture error from signIn() response (checks for ok: false)
- Check for ?error= in URL search params (Auth.js redirects with error on failure)
- Display red alert box with error message below the form when auth fails
- Clear error on new login attempt

Completes task 10.2 in user-accounts change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marko Djordjevic 2026-02-20 13:22:51 +01:00
parent 954dd27c88
commit 42a76ed41b
3 changed files with 33 additions and 4 deletions

View file

@ -57,7 +57,7 @@
## 10. Login Page
- [x] 10.1 `[sonnet]` Create `src/app/(public)/login/page.tsx` — login form matching Lovable design: email/password inputs, "Sign In" button calling `signIn("credentials")`, "Continue with Google" button calling `signIn("google")`
- [ ] 10.2 `[haiku]` Add error state display for invalid credentials
- [x] 10.2 `[haiku]` Add error state display for invalid credentials
- [ ] 10.3 `[haiku]` Add "Forgot password?" link (shows toast: "Not yet available"), "Sign up" link to `/register`
## 11. Register Page