Skip to content

Commit 3ef50aa

Browse files
authored
Merge pull request #58 from daveyplate/react-hook-form
React Hook Form & zod
2 parents a1b4463 + a7ef02a commit 3ef50aa

File tree

71 files changed

+4183
-2662
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+4183
-2662
lines changed

.cursor/rules/github.mdc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@ When asked to make a commit, immediately run git add -a & git commit -m "Short r
77
When asked to push, immediately run git push.
88
When asked to pull, immediately run git pull.
99

10-
Do not make commits unless the user asks you to.
11-
12-
Always search the codebase for relevant files and do research before you begin a task.
10+
Do not make commits unless the user asks you to.

.cursor/rules/instructions.mdc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
Always search the codebase for relevant files and do research before you begin a task.
7+
8+
Never hard code strings, always check AuthLocalization and add it as needed.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Plug & play shadcn/ui auth components for [better-auth](https://better-auth.com)
4646

4747
Fully customizable!
4848

49-
Coming Soon: Captcha, 2FA, and more!
49+
Coming Soon: Captcha, Organization, and more!
5050

5151
## License
5252

docs/content/docs/integrations/next-js.mdx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ export function Providers({ children }: { children: ReactNode }) {
5858
**Note**: Since the Next.js **App Router** caches routes by default, navigation to protected routes may fail until you perform a `router.refresh()` to clear the cache. To prevent this issue, you must use `router.refresh()` in the provided `onSessionChange` callback. This forces Next.js to clear the router cache and reload middleware-protected content, ensuring subsequent navigations accurately reflect the current auth state.
5959
</small>
6060

61-
**It is now recommended to call router.refresh() on page mount as well, since slow connections might fail to redirect.**
62-
6361
Once configured, wrap your layout component with the `Providers` component:
6462

6563
```tsx title="app/layout.tsx"
@@ -104,21 +102,8 @@ export default async function AuthPage({ params }: { params: Promise<{ pathname:
104102
"use client"
105103

106104
import { AuthCard } from "@daveyplate/better-auth-ui"
107-
import { useRouter } from "next/navigation"
108-
import { useEffect } from "react"
109-
110-
export function AuthView({
111-
pathname
112-
}: {
113-
pathname: string
114-
}) {
115-
const router = useRouter()
116-
117-
useEffect(() => {
118-
// Clear router cache (protected routes)
119-
router.refresh()
120-
}, [router])
121105

106+
export function AuthView({ pathname }: { pathname: string }) {
122107
return (
123108
<main className="flex flex-col grow p-4 items-center justify-center">
124109
<AuthCard pathname={pathname} />
@@ -133,10 +118,12 @@ The newly created dynamic route covers the following paths by default:
133118
- `/auth/sign-up` – New account registration
134119
- `/auth/magic-link` – Email login without a password
135120
- `/auth/forgot-password` – Trigger email to reset forgotten password
121+
- `/auth/two-factor` – Two-factor authentication
122+
- `/auth/recover-account` – Recover account via backup code
136123
- `/auth/reset-password` – Set new password after receiving reset link
137124
- `/auth/sign-out` – Log the user out of the application
138125
- `/auth/settings` – User account management page (requires authentication)
139-
- `/auth/callback` – Internal route to handle Auth callbacks (do not use directly)
126+
- `/auth/callback` – Internal route to handle Auth callbacks
140127

141128
Ensure that any links to the authentication process utilize these routes accordingly. All routes will render the `<AuthCard />` component and automatically handle navigation and authentication flow.
142129
</Step>

package.json

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,18 @@
6868
"license": "MIT",
6969
"devDependencies": {
7070
"@biomejs/biome": "1.9.4",
71-
"@radix-ui/react-checkbox": "^1.1.5",
71+
"@radix-ui/react-checkbox": "^1.2.2",
7272
"@radix-ui/react-context": "^1.1.2",
73-
"@radix-ui/react-dialog": "^1.1.7",
74-
"@radix-ui/react-label": "^2.1.3",
75-
"@radix-ui/react-primitive": "^2.0.3",
76-
"@radix-ui/react-separator": "^1.1.3",
73+
"@radix-ui/react-dialog": "^1.1.10",
74+
"@radix-ui/react-label": "^2.1.4",
75+
"@radix-ui/react-primitive": "^2.1.0",
76+
"@radix-ui/react-separator": "^1.1.4",
7777
"@radix-ui/react-slot": "^1.2.0",
78-
"@radix-ui/react-tabs": "^1.1.4",
78+
"@radix-ui/react-tabs": "^1.1.8",
7979
"@radix-ui/react-use-callback-ref": "^1.1.1",
8080
"@radix-ui/react-use-layout-effect": "^1.1.1",
8181
"@react-email/components": "^0.0.36",
82-
"@tanstack/react-query": "^5.74.3",
82+
"@tanstack/react-query": "^5.74.4",
8383
"@types/node": "^22.14.1",
8484
"@types/react": "^19.1.2",
8585
"@types/react-dom": "^19.1.2",
@@ -89,10 +89,10 @@
8989
"dotenv": "^16.5.0",
9090
"esbuild-plugin-preserve-directives": "^0.0.11",
9191
"ignore": "^7.0.3",
92-
"lucide-react": "^0.488.0",
93-
"next": "^15.3.0",
92+
"lucide-react": "^0.501.0",
93+
"next": "^15.3.1",
9494
"nodemon": "^3.1.9",
95-
"react-router": "^7.5.0",
95+
"react-router": "^7.5.1",
9696
"tailwind-merge": "^3.2.0",
9797
"tailwindcss-animate": "^1.0.7",
9898
"tsc-watch": "^6.2.1",
@@ -105,6 +105,7 @@
105105
"peerDependencies": {
106106
"@better-fetch/fetch": ">=1.1.0",
107107
"@daveyplate/better-auth-tanstack": "^1.3.3",
108+
"@hookform/resolvers": ">=5.0.0",
108109
"@instantdb/react": ">=0.18.0",
109110
"@radix-ui/react-avatar": ">=1.1.0",
110111
"@radix-ui/react-checkbox": ">=1.1.0",
@@ -125,13 +126,15 @@
125126
"clsx": ">=2.1.0",
126127
"input-otp": ">=1.4.0",
127128
"lucide-react": ">=0.469.0",
128-
"react-qr-code": ">=2.0.0",
129129
"react": ">=18.0.0",
130130
"react-dom": ">=18.0.0",
131+
"react-hook-form": ">=7.55.0",
132+
"react-qr-code": ">=2.0.0",
131133
"sonner": ">=1.7.0",
132134
"tailwind-merge": ">=2.6.0",
133135
"tailwindcss": ">=3.0.0",
134-
"ua-parser-js": ">=2.0.0"
136+
"ua-parser-js": ">=2.0.0",
137+
"zod": ">=3.24.0"
135138
},
136139
"pnpm": {
137140
"overrides": {}

0 commit comments

Comments
 (0)