fix the auth form
All checks were successful
Deploy / deploy (ubuntu-latest, 2.44.0) (push) Successful in 56s

This commit is contained in:
Braydon 2024-09-18 01:13:29 -04:00
parent ebefe705f4
commit 015a1fa9de
4 changed files with 38 additions and 7 deletions

@ -1,2 +1,3 @@
# www # www
The frontend for PulseApp. The frontend for PulseApp.

@ -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. * 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({ const EmailSchema = z.object({
email: z.string().email("Must be a valid email address."), email: buildEmailInput(false),
}); });
const RegisterSchema = z.object({ const RegisterSchema = z.object({
email: z.string().email("Must be a valid email address."), email: buildEmailInput(true),
username: z.string(), username: z.string(),
password: z.string(), password: z.string(),
passwordConfirmation: z.string(), passwordConfirmation: z.string(),
}); });
const LoginSchema = z.object({ const LoginSchema = z.object({
email: z.union([ email: buildEmailInput(true),
z.string().email("Must be a valid email address."),
z.string({ message: "Must be a valid username." }),
]),
password: z.string(), password: z.string(),
}); });

@ -8,7 +8,7 @@ import Link from "next/link";
*/ */
const Footer = (): ReactElement => ( const Footer = (): ReactElement => (
<footer className="flex justify-center text-center"> <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{" "} By registering you agree to our{" "}
<DocumentLink name="Terms and Conditions" link="/legal/terms" /> and <DocumentLink name="Terms and Conditions" link="/legal/terms" /> and
our <DocumentLink name="Privacy Policy" link="/legal/privacy" />. our <DocumentLink name="Privacy Policy" link="/legal/privacy" />.