mirror of
https://litchi.icu/ngc2207/judge4c.git
synced 2025-05-18 13:06:44 +00:00
feat: enhance LoginForm component with FormControl and FormMessage for improved validation feedback
This commit is contained in:
parent
d6202c5c57
commit
c3f1ef9b4e
@ -9,6 +9,14 @@ import {
|
|||||||
CardHeader,
|
CardHeader,
|
||||||
CardTitle,
|
CardTitle,
|
||||||
} from "@/components/ui/card";
|
} from "@/components/ui/card";
|
||||||
|
import {
|
||||||
|
Form,
|
||||||
|
FormControl,
|
||||||
|
FormField,
|
||||||
|
FormItem,
|
||||||
|
FormLabel,
|
||||||
|
FormMessage,
|
||||||
|
} from "@/components/ui/form";
|
||||||
import logger from "@/lib/logger";
|
import logger from "@/lib/logger";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { Loader2 } from "lucide-react";
|
import { Loader2 } from "lucide-react";
|
||||||
@ -19,7 +27,6 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { ToastAction } from "@/components/ui/toast";
|
import { ToastAction } from "@/components/ui/toast";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import userGetCurrentStore from "@/app/actions/(gitea)/user/store";
|
import userGetCurrentStore from "@/app/actions/(gitea)/user/store";
|
||||||
import { Form, FormField, FormItem, FormLabel } from "@/components/ui/form";
|
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
username: z.string().refine(
|
username: z.string().refine(
|
||||||
@ -113,7 +120,10 @@ export function LoginForm() {
|
|||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="grid gap-2">
|
<FormItem className="grid gap-2">
|
||||||
<FormLabel>Username or Email Address</FormLabel>
|
<FormLabel>Username or Email Address</FormLabel>
|
||||||
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
@ -131,7 +141,10 @@ export function LoginForm() {
|
|||||||
Forgot your password?
|
Forgot your password?
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
<FormControl>
|
||||||
<Input {...field} type="password" />
|
<Input {...field} type="password" />
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user