mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 21:35:19 +00:00
feat: config.js
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { LoginForm } from "@/components/auth/login-form"
|
||||
import { Card, CardContent, CardTitle } from "@/components/ui/card"
|
||||
import { ColoredText } from "@/components/ui/colored-text"
|
||||
import { IS_SELF_HOSTED_MODE, SELF_HOSTED_REDIRECT_URL } from "@/lib/constants"
|
||||
import config from "@/lib/config"
|
||||
import { redirect } from "next/navigation"
|
||||
|
||||
export default async function LoginPage() {
|
||||
if (IS_SELF_HOSTED_MODE) {
|
||||
redirect(SELF_HOSTED_REDIRECT_URL)
|
||||
if (config.selfHosted.isEnabled) {
|
||||
redirect(config.selfHosted.redirectUrl)
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,7 +3,7 @@ import { FormInput } from "@/components/forms/simple"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Card, CardDescription, CardTitle } from "@/components/ui/card"
|
||||
import { ColoredText } from "@/components/ui/colored-text"
|
||||
import { IS_SELF_HOSTED_MODE, SELF_HOSTED_REDIRECT_URL } from "@/lib/constants"
|
||||
import config from "@/lib/config"
|
||||
import { DEFAULT_CURRENCIES, DEFAULT_SETTINGS } from "@/models/defaults"
|
||||
import { getSelfHostedUser } from "@/models/users"
|
||||
import { ShieldAlert } from "lucide-react"
|
||||
@@ -11,7 +11,7 @@ import { redirect } from "next/navigation"
|
||||
import { selfHostedGetStartedAction } from "../actions"
|
||||
|
||||
export default async function SelfHostedWelcomePage() {
|
||||
if (!IS_SELF_HOSTED_MODE) {
|
||||
if (!config.selfHosted.isEnabled) {
|
||||
return (
|
||||
<Card className="w-full max-w-xl mx-auto p-8 flex flex-col items-center justify-center gap-6">
|
||||
<CardTitle className="text-2xl font-bold flex items-center gap-2">
|
||||
@@ -31,7 +31,7 @@ export default async function SelfHostedWelcomePage() {
|
||||
|
||||
const user = await getSelfHostedUser()
|
||||
if (user) {
|
||||
redirect(SELF_HOSTED_REDIRECT_URL)
|
||||
redirect(config.selfHosted.redirectUrl)
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { AUTH_LOGIN_URL, IS_SELF_HOSTED_MODE, SELF_HOSTED_WELCOME_URL } from "@/lib/constants"
|
||||
import config from "@/lib/config"
|
||||
import { createUserDefaults, isDatabaseEmpty } from "@/models/defaults"
|
||||
import { getSelfHostedUser } from "@/models/users"
|
||||
import { revalidatePath } from "next/cache"
|
||||
import { redirect } from "next/navigation"
|
||||
|
||||
export async function GET(request: Request) {
|
||||
if (!IS_SELF_HOSTED_MODE) {
|
||||
redirect(AUTH_LOGIN_URL)
|
||||
if (!config.selfHosted.isEnabled) {
|
||||
redirect(config.auth.loginUrl)
|
||||
}
|
||||
|
||||
const user = await getSelfHostedUser()
|
||||
if (!user) {
|
||||
redirect(SELF_HOSTED_WELCOME_URL)
|
||||
redirect(config.selfHosted.welcomeUrl)
|
||||
}
|
||||
|
||||
if (await isDatabaseEmpty(user.id)) {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import SignupForm from "@/components/auth/signup-form"
|
||||
import { Card, CardContent, CardTitle } from "@/components/ui/card"
|
||||
import { ColoredText } from "@/components/ui/colored-text"
|
||||
import { IS_SELF_HOSTED_MODE, SELF_HOSTED_REDIRECT_URL } from "@/lib/constants"
|
||||
import config from "@/lib/config"
|
||||
import { redirect } from "next/navigation"
|
||||
|
||||
export default async function LoginPage() {
|
||||
if (IS_SELF_HOSTED_MODE) {
|
||||
redirect(SELF_HOSTED_REDIRECT_URL)
|
||||
if (config.selfHosted.isEnabled) {
|
||||
redirect(config.selfHosted.redirectUrl)
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -15,10 +16,13 @@ export default async function LoginPage() {
|
||||
<ColoredText>TaxHacker: Cloud Edition</ColoredText>
|
||||
</CardTitle>
|
||||
<CardContent className="w-full">
|
||||
<div className="text-center text-md text-muted-foreground">
|
||||
Creating new account is disabled for now. Please use the self-hosted version.
|
||||
</div>
|
||||
{/* <SignupForm /> */}
|
||||
{config.auth.disableSignup ? (
|
||||
<div className="text-center text-md text-muted-foreground">
|
||||
Creating new account is disabled for now. Please use the self-hosted version.
|
||||
</div>
|
||||
) : (
|
||||
<SignupForm />
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user