fix the auth form
All checks were successful
Deploy / deploy (ubuntu-latest, 2.44.0) (push) Successful in 56s
All checks were successful
Deploy / deploy (ubuntu-latest, 2.44.0) (push) Successful in 56s
This commit is contained in:
parent
ebefe705f4
commit
015a1fa9de
22
src/app/(pages)/auth/layout.tsx
Normal file
22
src/app/(pages)/auth/layout.tsx
Normal file
@ -0,0 +1,22 @@
|
||||
import { ReactNode } from "react";
|
||||
import { Metadata } from "next";
|
||||
|
||||
/**
|
||||
* The metadata for this layout.
|
||||
*/
|
||||
export const metadata: Metadata = {
|
||||
title: "Auth",
|
||||
};
|
||||
|
||||
/**
|
||||
* The layout for the auth page.
|
||||
*
|
||||
* @param children the children to render
|
||||
* @returns the layout jsx
|
||||
*/
|
||||
const AuthLayout = ({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: ReactNode;
|
||||
}>): ReactNode => children;
|
||||
export default AuthLayout;
|
@ -25,22 +25,30 @@ import { TurnstileObject } from "turnstile-types";
|
||||
/**
|
||||
* Define the form schemas for the various stages.
|
||||
*/
|
||||
const buildEmailInput = (allowEmpty: boolean) =>
|
||||
z
|
||||
.string()
|
||||
.email("Invalid email address")
|
||||
.refine(
|
||||
(val) => {
|
||||
return !allowEmpty || val.length > 0;
|
||||
},
|
||||
{ message: "Email is required" }
|
||||
);
|
||||
|
||||
const EmailSchema = z.object({
|
||||
email: z.string().email("Must be a valid email address."),
|
||||
email: buildEmailInput(false),
|
||||
});
|
||||
|
||||
const RegisterSchema = z.object({
|
||||
email: z.string().email("Must be a valid email address."),
|
||||
email: buildEmailInput(true),
|
||||
username: z.string(),
|
||||
password: z.string(),
|
||||
passwordConfirmation: z.string(),
|
||||
});
|
||||
|
||||
const LoginSchema = z.object({
|
||||
email: z.union([
|
||||
z.string().email("Must be a valid email address."),
|
||||
z.string({ message: "Must be a valid username." }),
|
||||
]),
|
||||
email: buildEmailInput(true),
|
||||
password: z.string(),
|
||||
});
|
||||
|
||||
|
@ -8,7 +8,7 @@ import Link from "next/link";
|
||||
*/
|
||||
const Footer = (): ReactElement => (
|
||||
<footer className="flex justify-center text-center">
|
||||
<p className="max-w-[17rem] opacity-95">
|
||||
<p className="max-w-[17rem] opacity-95 select-none">
|
||||
By registering you agree to our{" "}
|
||||
<DocumentLink name="Terms and Conditions" link="/legal/terms" /> and
|
||||
our <DocumentLink name="Privacy Policy" link="/legal/privacy" />.
|
||||
|
Loading…
x
Reference in New Issue
Block a user