Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update remix-utils to v8 #908

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export async function loader({ request }: Route.LoaderArgs) {
await logout({ request, redirectTo: '/' })
}
const { toast, headers: toastHeaders } = await getToast(request)
const honeyProps = honeypot.getInputProps()
const honeyProps = await honeypot.getInputProps()

return data(
{
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_auth+/forgot-password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ForgotPasswordSchema = z.object({

export async function action({ request }: Route.ActionArgs) {
const formData = await request.formData()
checkHoneypot(formData)
await checkHoneypot(formData)
const submission = await parseWithZod(formData, {
schema: ForgotPasswordSchema.superRefine(async (data, ctx) => {
const user = await prisma.user.findFirst({
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_auth+/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function loader({ request }: Route.LoaderArgs) {
export async function action({ request }: Route.ActionArgs) {
await requireAnonymous(request)
const formData = await request.formData()
checkHoneypot(formData)
await checkHoneypot(formData)
const submission = await parseWithZod(formData, {
schema: (intent) =>
LoginFormSchema.transform(async (data, ctx) => {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_auth+/onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export async function loader({ request }: Route.LoaderArgs) {
export async function action({ request }: Route.ActionArgs) {
const email = await requireOnboardingEmail(request)
const formData = await request.formData()
checkHoneypot(formData)
await checkHoneypot(formData)
const submission = await parseWithZod(formData, {
schema: (intent) =>
SignupFormSchema.superRefine(async (data, ctx) => {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_auth+/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const SignupSchema = z.object({
export async function action({ request }: Route.ActionArgs) {
const formData = await request.formData()

checkHoneypot(formData)
await checkHoneypot(formData)

const submission = await parseWithZod(formData, {
schema: SignupSchema.superRefine(async (data, ctx) => {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_auth+/verify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const VerifySchema = z.object({

export async function action({ request }: Route.ActionArgs) {
const formData = await request.formData()
checkHoneypot(formData)
await checkHoneypot(formData)
return validateRequest(request, formData)
}

Expand Down
4 changes: 2 additions & 2 deletions app/utils/honeypot.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export const honeypot = new Honeypot({
encryptionSeed: process.env.HONEYPOT_SECRET,
})

export function checkHoneypot(formData: FormData) {
export async function checkHoneypot(formData: FormData) {
try {
honeypot.check(formData)
await honeypot.check(formData)
} catch (error) {
if (error instanceof SpamError) {
throw new Response('Form not submitted properly', { status: 400 })
Expand Down
78 changes: 48 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
"@epic-web/totp": "^2.0.0",
"@mjackson/form-data-parser": "^0.6.0",
"@nasa-gcn/remix-seo": "^2.0.1",
"@oslojs/crypto": "^1.0.1",
"@oslojs/encoding": "^1.1.0",
"@paralleldrive/cuid2": "^2.2.2",
"@prisma/client": "^6.2.1",
"@radix-ui/react-checkbox": "^1.1.3",
Expand Down Expand Up @@ -80,7 +82,6 @@
"compression": "^1.7.5",
"cookie": "^1.0.2",
"cross-env": "^7.0.3",
"crypto-js": "^4.2.0",
"date-fns": "^4.1.0",
"dotenv": "^16.4.7",
"execa": "^9.5.2",
Expand All @@ -102,7 +103,7 @@
"react-router": "^7.1.3",
"remix-auth": "^3.7.0",
"remix-auth-github": "^1.7.0",
"remix-utils": "^7.7.0",
"remix-utils": "^8.0.0",
"set-cookie-parser": "^2.7.1",
"sonner": "^1.7.2",
"source-map-support": "^0.5.21",
Expand Down