The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update forgot + reset password pages
Tim Wilsoncb19998a5e77
diff --git a/apps/web/app/app.dub.co/(auth)/auth/reset-password/[token]/page.tsx b/apps/web/app/app.dub.co/(auth)/auth/reset-password/[token]/page.tsxindex cebc2b96ed..a6be9b8100 100644--- a/apps/web/app/app.dub.co/(auth)/auth/reset-password/[token]/page.tsx+++ b/apps/web/app/app.dub.co/(auth)/auth/reset-password/[token]/page.tsx@@ -1,4 +1,5 @@import { ResetPasswordForm } from "@/ui/auth/reset-password-form";+import { AuthLayout } from "@/ui/layout/auth-layout";import EmptyState from "@/ui/shared/empty-state";import { prisma } from "@dub/prisma";import { InputPassword } from "@dub/ui";@@ -25,19 +26,16 @@ export default async function ResetPasswordPage({ params: { token } }: Props) {}return (- <div className="relative z-10 my-10 flex min-h-full w-full items-center justify-center">- <div className="mx-auto w-full max-w-md overflow-hidden border-y border-neutral-200 sm:rounded-2xl sm:border sm:shadow-xl">- <div className="flex flex-col items-center justify-center space-y-3 border-b border-neutral-200 bg-white px-4 py-6 pt-8 text-center sm:px-16">- <h3 className="text-xl font-semibold">Reset your password</h3>- <p className="text-sm text-neutral-500">- Enter new password for your account.- </p>- </div>- <div className="flex flex-col gap-3 bg-neutral-50 px-4 py-8 sm:px-16">+ <AuthLayout>+ <div className="w-full max-w-sm">+ <h3 className="text-center text-xl font-semibold">+ Reset your password+ </h3>+ <div className="mt-8"><ResetPasswordForm /></div></div>- </div>+ </AuthLayout>);}diff --git a/apps/web/app/app.dub.co/(auth)/forgot-password/page.tsx b/apps/web/app/app.dub.co/(auth)/forgot-password/page.tsxindex 3669959e10..64b282d01b 100644--- a/apps/web/app/app.dub.co/(auth)/forgot-password/page.tsx+++ b/apps/web/app/app.dub.co/(auth)/forgot-password/page.tsx@@ -1,7 +1,6 @@import { ForgotPasswordForm } from "@/ui/auth/forgot-password-form";import { AuthLayout } from "@/ui/layout/auth-layout";import { constructMetadata } from "@dub/utils";-import Link from "next/link";export const metadata = constructMetadata({title: `Forgot Password for ${process.env.NEXT_PUBLIC_APP_NAME}`,@@ -10,24 +9,15 @@ export const metadata = constructMetadata({export default function ForgotPasswordPage() {return (<AuthLayout>- <div className="w-full max-w-md overflow-hidden border-y border-neutral-200 sm:rounded-2xl sm:border sm:shadow-sm">- <div className="flex flex-col items-center justify-center space-y-3 border-b border-neutral-200 bg-white px-4 py-6 pt-8 text-center sm:px-16">- <h3 className="text-xl font-semibold">Reset your password</h3>- </div>+ <div className="w-full max-w-sm">+ <h3 className="text-center text-xl font-semibold">+ Reset your password+ </h3>- <div className="bg-neutral-50 px-4 py-8 sm:px-16">+ <div className="mt-8"><ForgotPasswordForm /></div></div>- <p className="mt-4 text-center text-sm text-neutral-500">- Already have an account? - <Link- href="/login"- className="font-semibold text-neutral-500 underline underline-offset-2 transition-colors hover:text-black"- >- Sign in- </Link>- </p></AuthLayout>);}diff --git a/apps/web/app/app.dub.co/(auth)/login/page.tsx b/apps/web/app/app.dub.co/(auth)/login/page.tsxindex ddef6ee3fc..ed413ebfa0 100644--- a/apps/web/app/app.dub.co/(auth)/login/page.tsx+++ b/apps/web/app/app.dub.co/(auth)/login/page.tsx@@ -10,7 +10,7 @@ export const metadata = constructMetadata({export default function LoginPage() {return (- <AuthLayout>+ <AuthLayout showTerms><div className="w-full max-w-sm"><h3 className="text-center text-xl font-semibold">Log in to your Dub accountdiff --git a/apps/web/app/app.dub.co/(auth)/register/page.tsx b/apps/web/app/app.dub.co/(auth)/register/page.tsxindex 786c3aed10..6d69d8b2eb 100644--- a/apps/web/app/app.dub.co/(auth)/register/page.tsx+++ b/apps/web/app/app.dub.co/(auth)/register/page.tsx@@ -9,7 +9,7 @@ export const metadata = constructMetadata({export default function RegisterPage() {return (- <AuthLayout>+ <AuthLayout showTerms><RegisterPageClient /></AuthLayout>);diff --git a/apps/web/ui/auth/forgot-password-form.tsx b/apps/web/ui/auth/forgot-password-form.tsxindex 8274b22436..e1603d57d6 100644--- a/apps/web/ui/auth/forgot-password-form.tsx+++ b/apps/web/ui/auth/forgot-password-form.tsx@@ -26,23 +26,24 @@ export const ForgotPasswordForm = () => {});return (- <div className="flex flex-col gap-3">+ <div className="flex w-full flex-col gap-3"><formonSubmit={(e) => {e.preventDefault();executeAsync({ email });}}>- <div className="flex flex-col gap-8">+ <div className="flex flex-col gap-6"><label>- <span className="text-sm font-medium text-neutral-700">Email</span>+ <span className="text-content-emphasis mb-2 block text-sm font-medium leading-none">+ </span><Inputtype="email"autoFocus={!isMobile}value={email}placeholder="[email protected]"onChange={(e) => setEmail(e.target.value)}- className="mt-1"/></label><Buttondiff --git a/apps/web/ui/auth/reset-password-form.tsx b/apps/web/ui/auth/reset-password-form.tsxindex 8ed2cc796f..d9a82e47e3 100644--- a/apps/web/ui/auth/reset-password-form.tsx+++ b/apps/web/ui/auth/reset-password-form.tsx@@ -2,7 +2,7 @@import z from "@/lib/zod";import { resetPasswordSchema } from "@/lib/zod/schemas/auth";-import { Button, Input, Label } from "@dub/ui";+import { Button, Input } from "@dub/ui";import { useParams, useRouter } from "next/navigation";import { useForm } from "react-hook-form";import { toast } from "sonner";@@ -43,11 +43,13 @@ export const ResetPasswordForm = () => {return (<>- <form className="flex flex-col gap-5" onSubmit={onSubmit}>+ <form className="flex w-full flex-col gap-6" onSubmit={onSubmit}><input type="hidden" value={token} {...register("token")} />- <div className="grid w-full max-w-sm items-center gap-2">- <Label htmlFor="password">Password</Label>+ <label>+ <span className="text-content-emphasis mb-2 block text-sm font-medium leading-none">+ Password+ </span><Inputtype="password"{...register("password")}@@ -63,10 +65,12 @@ export const ResetPasswordForm = () => {{errors.password.message}</span>)}- </div>+ </label>- <div className="grid w-full max-w-sm items-center gap-2">- <Label htmlFor="confirmPassword">Confirm Password</Label>+ <label>+ <span className="text-content-emphasis mb-2 block text-sm font-medium leading-none">+ Confirm password+ </span><Inputtype="password"{...register("confirmPassword")}@@ -82,7 +86,7 @@ export const ResetPasswordForm = () => {{errors.confirmPassword.message}</span>)}- </div>+ </label><Buttontext="Reset Password"diff --git a/apps/web/ui/layout/auth-layout.tsx b/apps/web/ui/layout/auth-layout.tsxindex d03aad8ce4..ddb1d5df5c 100644--- a/apps/web/ui/layout/auth-layout.tsx+++ b/apps/web/ui/layout/auth-layout.tsx@@ -1,13 +1,12 @@import { ClientOnly } from "@dub/ui";-import { Suspense } from "react";+import { PropsWithChildren, Suspense } from "react";-interface AuthLayoutProps {- children: React.ReactNode;-}--export const AuthLayout = ({ children }: AuthLayoutProps) => {+export const AuthLayout = ({+ showTerms = false,+ children,+}: PropsWithChildren<{ showTerms?: boolean }>) => {return (- <div className="flex min-h-screen flex-col items-center justify-between">+ <div className="flex min-h-screen w-full flex-col items-center justify-between">{/* Empty div to help center main content */}<div className="grow basis-0"><div className="h-20" />@@ -18,24 +17,26 @@ export const AuthLayout = ({ children }: AuthLayoutProps) => {</ClientOnly><div className="flex grow basis-0 flex-col justify-end">- <p className="px-20 py-8 text-center text-xs font-medium text-neutral-500 md:px-0">- By continuing, you agree to Dub’s{" "}- <a- href="https://dub.co/legal/terms"- target="_blank"- className="font-semibold text-neutral-600 hover:text-neutral-800"- >- Terms of Service- </a>{" "}- and{" "}- <a- href="https://dub.co/legal/privacy"- target="_blank"- className="font-semibold text-neutral-600 hover:text-neutral-800"- >- Privacy Policy- </a>- </p>+ {showTerms && (+ <p className="px-20 py-8 text-center text-xs font-medium text-neutral-500 md:px-0">+ By continuing, you agree to Dub’s{" "}+ <a+ href="https://dub.co/legal/terms"+ target="_blank"+ className="font-semibold text-neutral-600 hover:text-neutral-800"+ >+ Terms of Service+ </a>{" "}+ and{" "}+ <a+ href="https://dub.co/legal/privacy"+ target="_blank"+ className="font-semibold text-neutral-600 hover:text-neutral-800"+ >+ Privacy Policy+ </a>+ </p>+ )}</div></div>);