rf/fix: use NEXT_PUBLIC for signup status env, quick style fixes
This commit is contained in:
parent
0a8414ee2c
commit
e41e2a9a80
@ -5,13 +5,13 @@ export default function SignupLayout({
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
if (process.env.SIGNUP_ENABLED === "false") {
|
||||
if (process.env.NEXT_PUBLIC_SIGNUP_ENABLED === "false") {
|
||||
return <div>Signup is disabled</div>
|
||||
} else if (process.env.SIGNUP_ENABLED === "true") {
|
||||
} else if (process.env.NEXT_PUBLIC_SIGNUP_ENABLED === "true") {
|
||||
return (
|
||||
<div className="min-h-screen bg-background">{children}</div>
|
||||
)
|
||||
} else {
|
||||
return <div>Invalid SIGNUP_ENABLED environment variable</div>
|
||||
return <div>Invalid NEXT_PUBLIC_SIGNUP_ENABLED environment variable</div>
|
||||
}
|
||||
}
|
@ -8,9 +8,9 @@ import { validateToken } from "@/lib/utils"
|
||||
|
||||
async function createEmail(email: string, password: string, migrate: boolean) {
|
||||
// Signup status check
|
||||
if (process.env.SIGNUP_ENABLED === "false") {
|
||||
if (process.env.NEXT_PUBLIC_SIGNUP_ENABLED === "false") {
|
||||
return { success: false, message: "Signups are disabled" }
|
||||
} else if (process.env.SIGNUP_ENABLED === "true") {
|
||||
} else if (process.env.NEXT_PUBLIC_SIGNUP_ENABLED === "true") {
|
||||
try {
|
||||
if (!process.env.MAIL_CONNECT_API_URL) {
|
||||
console.error("[!] Missing MAIL_CONNECT_API_URL environment variable")
|
||||
@ -49,7 +49,7 @@ async function createEmail(email: string, password: string, migrate: boolean) {
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
if (process.env.SIGNUP_ENABLED === "true") {
|
||||
if (process.env.NEXT_PUBLIC_SIGNUP_ENABLED === "true") {
|
||||
try {
|
||||
const body = await request.json()
|
||||
const { name, email, password, migrate, token } = body
|
||||
@ -176,7 +176,7 @@ export async function POST(request: Request) {
|
||||
console.error("[!] Unhandled error while creating user:", error)
|
||||
return NextResponse.json({ success: false, message: "An unexpected error occurred" }, { status: 500 })
|
||||
}
|
||||
} else if (process.env.SIGNUP_ENABLED === "false") {
|
||||
} else if (process.env.NEXT_PUBLIC_SIGNUP_ENABLED === "false") {
|
||||
return NextResponse.json({ success: false, message: "Signups are disabled" }, { status: 403 })
|
||||
} else {
|
||||
return NextResponse.json({ success: false, message: "Account signup is not configured in your environment variables!" }, { status: 500 })
|
||||
|
@ -23,9 +23,9 @@ const Hero = () => {
|
||||
</p>
|
||||
<div className="mt-10 max-w-md mx-auto sm:flex sm:justify-center">
|
||||
<div className="rounded-md shadow-sm">
|
||||
{process.env.SIGNUP_ENABLED === "true" ? (
|
||||
{process.env.NEXT_PUBLIC_SIGNUP_ENABLED === "true" ? (
|
||||
<Link href="/account/login">
|
||||
<Button className="py-6 px-8">
|
||||
<Button className="py-6 px-8 cursor-pointer">
|
||||
Get Started
|
||||
<ArrowRight className="ml-2 h-5 w-5" />
|
||||
</Button>
|
||||
|
@ -184,9 +184,9 @@ const PricingCard: React.FC<PricingCardProps> = ({
|
||||
<Clock /> Coming Soon
|
||||
</Button>
|
||||
) : buttonText ? (
|
||||
process.env.SIGNUP_ENABLED === "true" ? (
|
||||
process.env.NEXT_PUBLIC_SIGNUP_ENABLED === "true" ? (
|
||||
<Link href="/account/login" className="block">
|
||||
<Button className="w-full group" size="lg">
|
||||
<Button className="w-full group cursor-pointer" size="lg">
|
||||
{buttonText}
|
||||
{buttonIcon}
|
||||
</Button>
|
||||
|
@ -11,7 +11,7 @@ With these variables, you can disable entire parts of the dashboard, such as reg
|
||||
|
||||
| Environment Variable | Description | Expected Value |
|
||||
|----------------------------------|-----------------------------------------------------------|----------------------------------------|
|
||||
| SIGNUP_ENABLED | Controls if the signup page and APIs are enabled/disabled | `true` (Enabled) or `false` (Disabled) |
|
||||
| NEXT_PUBLIC_SIGNUP_ENABLED | Controls if the signup page and APIs are enabled/disabled | `true` (Enabled) or `false` (Disabled) |
|
||||
| NEXT_PUBLIC_DONATE_URL | Changes the universal donation link for buttons/links | String - `https://...` |
|
||||
| NEXT_PUBLIC_SUPPORT_EMAIL | Email displayed in the "Support" tab of dashboard | String - `example@example.com` |
|
||||
| NEXT_PUBLIC_TELEGRAM_CHANNEL_URL | Changes the default Telegram channel link in Support dash | String - `https://t.me/...` |
|
||||
|
Loading…
x
Reference in New Issue
Block a user