Compare commits
No files matched your search
@@ -1,7 +1,13 @@
|
|||||||
"use client"
|
import { fetchQuery } from "convex/nextjs"
|
||||||
|
import { connection } from "next/server"
|
||||||
import { AuthForm } from "@/components/auth-form"
|
import { AuthForm } from "@/components/auth-form"
|
||||||
|
import { api } from "@otunes/convex/_generated/api"
|
||||||
|
|
||||||
export default function SignInPage() {
|
export default async function SignInPage() {
|
||||||
return <AuthForm flow="signIn" />
|
await connection()
|
||||||
|
const { disableAccountCreation } = await fetchQuery(api.users.getAppSettings)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AuthForm flow="signIn" accountCreationDisabled={disableAccountCreation} />
|
||||||
|
)
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,13 @@
|
|||||||
"use client"
|
import { fetchQuery } from "convex/nextjs"
|
||||||
|
import { connection } from "next/server"
|
||||||
import { AuthForm } from "@/components/auth-form"
|
import { AuthForm } from "@/components/auth-form"
|
||||||
|
import { api } from "@otunes/convex/_generated/api"
|
||||||
|
|
||||||
export default function SignUpPage() {
|
export default async function SignUpPage() {
|
||||||
return <AuthForm flow="signUp" />
|
await connection()
|
||||||
|
const { disableAccountCreation } = await fetchQuery(api.users.getAppSettings)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AuthForm flow="signUp" accountCreationDisabled={disableAccountCreation} />
|
||||||
|
)
|
||||||
}
|
}
|
||||||
@@ -4,10 +4,8 @@ import { useState } from "react"
|
|||||||
import { useRouter } from "next/navigation"
|
import { useRouter } from "next/navigation"
|
||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
import { useAuthActions } from "@convex-dev/auth/react"
|
import { useAuthActions } from "@convex-dev/auth/react"
|
||||||
import { useQuery } from "convex/react"
|
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { api } from "@otunes/convex/_generated/api"
|
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
@@ -50,15 +48,19 @@ const copy: Record<
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AuthForm({ flow }: { flow: AuthFlow }) {
|
export function AuthForm({
|
||||||
|
flow,
|
||||||
|
accountCreationDisabled,
|
||||||
|
}: {
|
||||||
|
flow: AuthFlow
|
||||||
|
accountCreationDisabled: boolean
|
||||||
|
}) {
|
||||||
const { signIn } = useAuthActions()
|
const { signIn } = useAuthActions()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const appSettings = useQuery(api.users.getAppSettings)
|
|
||||||
const [error, setError] = useState<string | null>(null)
|
const [error, setError] = useState<string | null>(null)
|
||||||
const [submitting, setSubmitting] = useState(false)
|
const [submitting, setSubmitting] = useState(false)
|
||||||
|
|
||||||
const text = copy[flow]
|
const text = copy[flow]
|
||||||
const accountCreationDisabled = appSettings?.disableAccountCreation ?? false
|
|
||||||
const signupsDisabled = flow === "signUp" && accountCreationDisabled
|
const signupsDisabled = flow === "signUp" && accountCreationDisabled
|
||||||
const hideSignUpLink = flow === "signIn" && accountCreationDisabled
|
const hideSignUpLink = flow === "signIn" && accountCreationDisabled
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user