diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx index 467c248..a3da97c 100644 --- a/app/(auth)/login/page.tsx +++ b/app/(auth)/login/page.tsx @@ -8,7 +8,7 @@ export default function LoginPage() {
<> diff --git a/app/(auth)/register/page.tsx b/app/(auth)/register/page.tsx index 057a240..30898b7 100644 --- a/app/(auth)/register/page.tsx +++ b/app/(auth)/register/page.tsx @@ -8,7 +8,7 @@ export default function RegisterPage() {
Login diff --git a/components/user-auth-form.tsx b/components/user-auth-form.tsx index d50383c..92dbf1f 100644 --- a/components/user-auth-form.tsx +++ b/components/user-auth-form.tsx @@ -26,30 +26,29 @@ export function UserAuthForm({ className, ...props }: UserAuthFormProps) { const [isLoading, setIsLoading] = React.useState(false) async function onSubmit(data: FormData) { - return toast({ - message: - "I've temporarily disabled authentication until I figure out a deployment issue.", - type: "error", + setIsLoading(true) + + const signInResult = await signIn("email", { + email: data.email.toLowerCase(), + redirect: false, + callbackUrl: `${window.location.origin}/dashboard`, + }) + + setIsLoading(false) + + if (!signInResult?.ok) { + return toast({ + title: "Something went wrong.", + message: "Your post was not saved. Please try again.", + type: "error", + }) + } + + return toast({ + title: "Check your email", + message: "We sent you a login link. Be sure to check your spam too.", + type: "success", }) - // setIsLoading(true) - // const signInResult = await signIn("email", { - // email: data.email.toLowerCase(), - // redirect: false, - // callbackUrl: `${window.location.origin}/dashboard`, - // }) - // setIsLoading(false) - // if (!signInResult?.ok) { - // return toast({ - // title: "Something went wrong.", - // message: "Your post was not saved. Please try again.", - // type: "error", - // }) - // } - // return toast({ - // title: "Check your email", - // message: "We sent you a login link. Be sure to check your spam too.", - // type: "success", - // }) } return ( @@ -97,7 +96,6 @@ export function UserAuthForm({ className, ...props }: UserAuthFormProps) {