diff --git a/admin/app/layout.tsx b/admin/app/layout.tsx index d2df31d59..e2879a565 100644 --- a/admin/app/layout.tsx +++ b/admin/app/layout.tsx @@ -1,15 +1,17 @@ import { ReactNode } from "react"; import { Metadata } from "next"; // components -import { InstanceFailureView, InstanceNotReady } from "@/components/instance"; +import { InstanceFailureView, InstanceSetupForm } from "@/components/instance"; // helpers import { ASSET_PREFIX } from "@/helpers/common.helper"; +// layout +import { DefaultLayout } from "@/layouts/default-layout"; // lib import { AppProvider } from "@/lib/app-providers"; // styles import "./globals.css"; // services -import { InstanceService } from "@/services"; +import { InstanceService } from "@/services/instance.service"; const instanceService = new InstanceService(); @@ -45,9 +47,23 @@ export default async function RootLayout({ children }: { children: ReactNode }) {instanceDetails ? ( - <>{instanceDetails?.instance?.is_setup_done ? <>{children} : } + <> + {instanceDetails?.instance?.is_setup_done ? ( + <>{children} + ) : ( + +
+ +
+
+ )} + ) : ( - + +
+ +
+
)}
diff --git a/admin/app/setup/components/index.ts b/admin/app/setup/components/index.ts deleted file mode 100644 index 558353b2e..000000000 --- a/admin/app/setup/components/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./sign-up-form"; diff --git a/admin/app/setup/layout.tsx b/admin/app/setup/layout.tsx index ba889b7ae..61038f97f 100644 --- a/admin/app/setup/layout.tsx +++ b/admin/app/setup/layout.tsx @@ -1,23 +1,14 @@ "use client"; import { ReactNode } from "react"; -// helpers -import { EAuthenticationPageType, EInstancePageType } from "@/helpers"; -// lib -import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers"; - +// layouts +import { DefaultLayout } from "@/layouts/default-layout"; interface SetupLayoutProps { children: ReactNode; params: any; } export default function SetupLayout(props: SetupLayoutProps) { - const { children, params } = props; - const { error_code } = params; - console.log("error_code", error_code); - return ( - - {children} - - ); + const { children } = props; + return {children}; } diff --git a/admin/app/setup/page.tsx b/admin/app/setup/page.tsx index 1ef22b1f2..06174f792 100644 --- a/admin/app/setup/page.tsx +++ b/admin/app/setup/page.tsx @@ -1,19 +1,11 @@ import { Metadata } from "next"; -// layouts -import { DefaultLayout } from "@/layouts/default-layout"; // components -import { InstanceSignUpForm } from "./components"; +import { InstanceSetupForm } from "@/components/instance"; export const metadata: Metadata = { title: "Setup - God Mode", }; export default function SetupPage() { - return ( - <> - - - - - ); + return ; } diff --git a/admin/components/admin-sidebar/sidebar-dropdown.tsx b/admin/components/admin-sidebar/sidebar-dropdown.tsx index f7de3f277..84583e24b 100644 --- a/admin/components/admin-sidebar/sidebar-dropdown.tsx +++ b/admin/components/admin-sidebar/sidebar-dropdown.tsx @@ -11,7 +11,7 @@ import { API_BASE_URL, cn } from "@/helpers/common.helper"; import { useTheme, useUser } from "@/hooks/store"; // helpers // services -import { AuthService } from "@/services"; +import { AuthService } from "@/services/auth.service"; // service initialization const authService = new AuthService(); diff --git a/admin/components/instance/index.ts b/admin/components/instance/index.ts index 1f52843a0..56d1933f4 100644 --- a/admin/components/instance/index.ts +++ b/admin/components/instance/index.ts @@ -1,2 +1,3 @@ export * from "./instance-not-ready"; export * from "./instance-failure-view"; +export * from "./setup-form"; diff --git a/admin/app/setup/components/sign-up-form.tsx b/admin/components/instance/setup-form.tsx similarity index 98% rename from admin/app/setup/components/sign-up-form.tsx rename to admin/components/instance/setup-form.tsx index 1a117620d..c3dfb5dcb 100644 --- a/admin/app/setup/components/sign-up-form.tsx +++ b/admin/components/instance/setup-form.tsx @@ -52,7 +52,7 @@ const defaultFromData: TFormData = { is_telemetry_enabled: true, }; -export const InstanceSignUpForm: FC = (props) => { +export const InstanceSetupForm: FC = (props) => { const {} = props; // search params const searchParams = useSearchParams(); @@ -122,7 +122,7 @@ export const InstanceSignUpForm: FC = (props) => { ); return ( -
+

diff --git a/admin/services/index.ts b/admin/services/index.ts deleted file mode 100644 index 57313a87f..000000000 --- a/admin/services/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./auth.service"; -export * from "./instance.service"; -export * from "./user.service"; diff --git a/admin/services/instance.service.ts b/admin/services/instance.service.ts index e995ee821..13431a834 100644 --- a/admin/services/instance.service.ts +++ b/admin/services/instance.service.ts @@ -13,8 +13,7 @@ export class InstanceService extends APIService { return this.get("/api/instances/") .then((response) => response.data) .catch((error) => { - console.log("error", error); - throw error; + throw error?.response?.data; }); } diff --git a/admin/store/user.store.ts b/admin/store/user.store.ts index 271c6be34..60638f0cd 100644 --- a/admin/store/user.store.ts +++ b/admin/store/user.store.ts @@ -3,7 +3,7 @@ import { IUser } from "@plane/types"; // helpers import { EUserStatus, TUserStatus } from "@/helpers"; // services -import { AuthService } from "@/services"; +import { AuthService } from "@/services/auth.service"; import { UserService } from "@/services/user.service"; // root store import { RootStore } from "@/store/root.store"; diff --git a/apiserver/plane/license/utils/encryption.py b/apiserver/plane/license/utils/encryption.py index 11bd9000e..6781605dd 100644 --- a/apiserver/plane/license/utils/encryption.py +++ b/apiserver/plane/license/utils/encryption.py @@ -3,6 +3,8 @@ import hashlib from django.conf import settings from cryptography.fernet import Fernet +from plane.utils.exception_logger import log_exception + def derive_key(secret_key): # Use a key derivation function to get a suitable encryption key @@ -12,21 +14,29 @@ def derive_key(secret_key): # Encrypt data def encrypt_data(data): - if data: - cipher_suite = Fernet(derive_key(settings.SECRET_KEY)) - encrypted_data = cipher_suite.encrypt(data.encode()) - return encrypted_data.decode() # Convert bytes to string - else: + try: + if data: + cipher_suite = Fernet(derive_key(settings.SECRET_KEY)) + encrypted_data = cipher_suite.encrypt(data.encode()) + return encrypted_data.decode() # Convert bytes to string + else: + return "" + except Exception as e: + log_exception(e) return "" # Decrypt data def decrypt_data(encrypted_data): - if encrypted_data: - cipher_suite = Fernet(derive_key(settings.SECRET_KEY)) - decrypted_data = cipher_suite.decrypt( - encrypted_data.encode() - ) # Convert string back to bytes - return decrypted_data.decode() - else: + try: + if encrypted_data: + cipher_suite = Fernet(derive_key(settings.SECRET_KEY)) + decrypted_data = cipher_suite.decrypt( + encrypted_data.encode() + ) # Convert string back to bytes + return decrypted_data.decode() + else: + return "" + except Exception as e: + log_exception(e) return ""