Define the reset-password form schema in shared
Some checks failed
CD / Build and push images (push) Successful in 1m42s
CI / Lint, typecheck, test (push) Successful in 1m13s
CI / Auth e2e pack (push) Failing after 40s
CI / Build container images (push) Has been skipped
CD / Deploy to Test (push) Successful in 7s
CD / Smoke tests against Test (push) Successful in 1m4s
CD / Promote to Int (push) Successful in 9s

Composing z.object() in the web app around a schema imported from
@dorfteich/shared mixes two zod type instances and breaks the
zodResolver overload on fresh installs (CI). Like the other forms,
the schema now lives in the shared package.

Part of #20

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Claude Fable 5 2026-07-05 05:47:40 +02:00
parent 1cea675983
commit 58d3a0b80f
2 changed files with 4 additions and 5 deletions

View File

@ -1,23 +1,20 @@
import { zodResolver } from '@hookform/resolvers/zod';
import { passwordSchema } from '@dorfteich/shared';
import { resetPasswordFormSchema } from '@dorfteich/shared';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import { Link, useSearchParams } from 'react-router-dom';
import { z } from 'zod';
import { Field, FormError } from '../../components/forms';
import { apiPost } from '../../lib/api';
const formSchema = z.object({ password: passwordSchema });
export function ResetPasswordPage(): React.JSX.Element {
const { t } = useTranslation();
const [params] = useSearchParams();
const [error, setError] = useState<unknown>(null);
const [done, setDone] = useState(false);
const form = useForm({ resolver: zodResolver(formSchema) });
const form = useForm({ resolver: zodResolver(resetPasswordFormSchema) });
const token = params.get('token') ?? '';
const onSubmit = form.handleSubmit(async (input) => {

View File

@ -66,6 +66,8 @@ export const resetPasswordInputSchema = z.object({
token: z.string().min(16).max(256),
password: passwordSchema,
});
/** Form-side schema for the reset page (token travels via URL, not form). */
export const resetPasswordFormSchema = z.object({ password: passwordSchema });
export const updateProfileInputSchema = z.object({
displayName: z.string().trim().min(1, 'validation.displayName.required').max(80).optional(),
locale: z.enum(['de', 'en']).optional(),