mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
Merge branch 'preview' of https://github.com/makeplane/plane into feat-pages-collaboration
This commit is contained in:
commit
8c46a54e9e
@ -1,15 +1,17 @@
|
|||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
import { Metadata } from "next";
|
import { Metadata } from "next";
|
||||||
// components
|
// components
|
||||||
import { InstanceFailureView, InstanceNotReady } from "@/components/instance";
|
import { InstanceFailureView, InstanceSetupForm } from "@/components/instance";
|
||||||
// helpers
|
// helpers
|
||||||
import { ASSET_PREFIX } from "@/helpers/common.helper";
|
import { ASSET_PREFIX } from "@/helpers/common.helper";
|
||||||
|
// layout
|
||||||
|
import { DefaultLayout } from "@/layouts/default-layout";
|
||||||
// lib
|
// lib
|
||||||
import { AppProvider } from "@/lib/app-providers";
|
import { AppProvider } from "@/lib/app-providers";
|
||||||
// styles
|
// styles
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
// services
|
// services
|
||||||
import { InstanceService } from "@/services";
|
import { InstanceService } from "@/services/instance.service";
|
||||||
|
|
||||||
const instanceService = new InstanceService();
|
const instanceService = new InstanceService();
|
||||||
|
|
||||||
@ -45,9 +47,23 @@ export default async function RootLayout({ children }: { children: ReactNode })
|
|||||||
<body className={`antialiased`}>
|
<body className={`antialiased`}>
|
||||||
<AppProvider initialState={{ instance: instanceDetails }}>
|
<AppProvider initialState={{ instance: instanceDetails }}>
|
||||||
{instanceDetails ? (
|
{instanceDetails ? (
|
||||||
<>{instanceDetails?.instance?.is_setup_done ? <>{children}</> : <InstanceNotReady />}</>
|
<>
|
||||||
|
{instanceDetails?.instance?.is_setup_done ? (
|
||||||
|
<>{children}</>
|
||||||
|
) : (
|
||||||
|
<DefaultLayout>
|
||||||
|
<div className="relative w-screen min-h-screen overflow-y-auto px-5 py-10 mx-auto flex justify-center items-center">
|
||||||
|
<InstanceSetupForm />
|
||||||
|
</div>
|
||||||
|
</DefaultLayout>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<InstanceFailureView />
|
<DefaultLayout>
|
||||||
|
<div className="relative w-screen min-h-[500px] overflow-y-auto px-5 mx-auto flex justify-center items-center">
|
||||||
|
<InstanceFailureView />
|
||||||
|
</div>
|
||||||
|
</DefaultLayout>
|
||||||
)}
|
)}
|
||||||
</AppProvider>
|
</AppProvider>
|
||||||
</body>
|
</body>
|
||||||
|
@ -1 +0,0 @@
|
|||||||
export * from "./sign-up-form";
|
|
@ -1,23 +1,14 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
// helpers
|
// layouts
|
||||||
import { EAuthenticationPageType, EInstancePageType } from "@/helpers";
|
import { DefaultLayout } from "@/layouts/default-layout";
|
||||||
// lib
|
|
||||||
import { AuthWrapper, InstanceWrapper } from "@/lib/wrappers";
|
|
||||||
|
|
||||||
interface SetupLayoutProps {
|
interface SetupLayoutProps {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
params: any;
|
params: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SetupLayout(props: SetupLayoutProps) {
|
export default function SetupLayout(props: SetupLayoutProps) {
|
||||||
const { children, params } = props;
|
const { children } = props;
|
||||||
const { error_code } = params;
|
return <DefaultLayout>{children}</DefaultLayout>;
|
||||||
console.log("error_code", error_code);
|
|
||||||
return (
|
|
||||||
<InstanceWrapper pageType={EInstancePageType.PRE_SETUP}>
|
|
||||||
<AuthWrapper authType={EAuthenticationPageType.NOT_AUTHENTICATED}>{children}</AuthWrapper>
|
|
||||||
</InstanceWrapper>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,11 @@
|
|||||||
import { Metadata } from "next";
|
import { Metadata } from "next";
|
||||||
// layouts
|
|
||||||
import { DefaultLayout } from "@/layouts/default-layout";
|
|
||||||
// components
|
// components
|
||||||
import { InstanceSignUpForm } from "./components";
|
import { InstanceSetupForm } from "@/components/instance";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "Setup - God Mode",
|
title: "Setup - God Mode",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function SetupPage() {
|
export default function SetupPage() {
|
||||||
return (
|
return <InstanceSetupForm />;
|
||||||
<>
|
|
||||||
<DefaultLayout>
|
|
||||||
<InstanceSignUpForm />
|
|
||||||
</DefaultLayout>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import { API_BASE_URL, cn } from "@/helpers/common.helper";
|
|||||||
import { useTheme, useUser } from "@/hooks/store";
|
import { useTheme, useUser } from "@/hooks/store";
|
||||||
// helpers
|
// helpers
|
||||||
// services
|
// services
|
||||||
import { AuthService } from "@/services";
|
import { AuthService } from "@/services/auth.service";
|
||||||
|
|
||||||
// service initialization
|
// service initialization
|
||||||
const authService = new AuthService();
|
const authService = new AuthService();
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
export * from "./instance-not-ready";
|
export * from "./instance-not-ready";
|
||||||
export * from "./instance-failure-view";
|
export * from "./instance-failure-view";
|
||||||
|
export * from "./setup-form";
|
||||||
|
@ -52,7 +52,7 @@ const defaultFromData: TFormData = {
|
|||||||
is_telemetry_enabled: true,
|
is_telemetry_enabled: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const InstanceSignUpForm: FC = (props) => {
|
export const InstanceSetupForm: FC = (props) => {
|
||||||
const {} = props;
|
const {} = props;
|
||||||
// search params
|
// search params
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
@ -122,7 +122,7 @@ export const InstanceSignUpForm: FC = (props) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative w-full h-full overflow-hidden container mx-auto max-w-lg px-10 lg:max-w-md lg:px-5 flex flex-col justify-center items-center">
|
<div className="max-w-lg px-10 lg:max-w-md lg:px-5">
|
||||||
<div className="relative flex flex-col space-y-6">
|
<div className="relative flex flex-col space-y-6">
|
||||||
<div className="text-center space-y-1">
|
<div className="text-center space-y-1">
|
||||||
<h3 className="flex gap-4 justify-center text-3xl font-bold text-onboarding-text-100">
|
<h3 className="flex gap-4 justify-center text-3xl font-bold text-onboarding-text-100">
|
@ -1,3 +0,0 @@
|
|||||||
export * from "./auth.service";
|
|
||||||
export * from "./instance.service";
|
|
||||||
export * from "./user.service";
|
|
@ -13,8 +13,7 @@ export class InstanceService extends APIService {
|
|||||||
return this.get<IInstance>("/api/instances/")
|
return this.get<IInstance>("/api/instances/")
|
||||||
.then((response) => response.data)
|
.then((response) => response.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log("error", error);
|
throw error?.response?.data;
|
||||||
throw error;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import { IUser } from "@plane/types";
|
|||||||
// helpers
|
// helpers
|
||||||
import { EUserStatus, TUserStatus } from "@/helpers";
|
import { EUserStatus, TUserStatus } from "@/helpers";
|
||||||
// services
|
// services
|
||||||
import { AuthService } from "@/services";
|
import { AuthService } from "@/services/auth.service";
|
||||||
import { UserService } from "@/services/user.service";
|
import { UserService } from "@/services/user.service";
|
||||||
// root store
|
// root store
|
||||||
import { RootStore } from "@/store/root.store";
|
import { RootStore } from "@/store/root.store";
|
||||||
|
@ -3,6 +3,8 @@ import hashlib
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from cryptography.fernet import Fernet
|
from cryptography.fernet import Fernet
|
||||||
|
|
||||||
|
from plane.utils.exception_logger import log_exception
|
||||||
|
|
||||||
|
|
||||||
def derive_key(secret_key):
|
def derive_key(secret_key):
|
||||||
# Use a key derivation function to get a suitable encryption key
|
# Use a key derivation function to get a suitable encryption key
|
||||||
@ -12,21 +14,29 @@ def derive_key(secret_key):
|
|||||||
|
|
||||||
# Encrypt data
|
# Encrypt data
|
||||||
def encrypt_data(data):
|
def encrypt_data(data):
|
||||||
if data:
|
try:
|
||||||
cipher_suite = Fernet(derive_key(settings.SECRET_KEY))
|
if data:
|
||||||
encrypted_data = cipher_suite.encrypt(data.encode())
|
cipher_suite = Fernet(derive_key(settings.SECRET_KEY))
|
||||||
return encrypted_data.decode() # Convert bytes to string
|
encrypted_data = cipher_suite.encrypt(data.encode())
|
||||||
else:
|
return encrypted_data.decode() # Convert bytes to string
|
||||||
|
else:
|
||||||
|
return ""
|
||||||
|
except Exception as e:
|
||||||
|
log_exception(e)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
# Decrypt data
|
# Decrypt data
|
||||||
def decrypt_data(encrypted_data):
|
def decrypt_data(encrypted_data):
|
||||||
if encrypted_data:
|
try:
|
||||||
cipher_suite = Fernet(derive_key(settings.SECRET_KEY))
|
if encrypted_data:
|
||||||
decrypted_data = cipher_suite.decrypt(
|
cipher_suite = Fernet(derive_key(settings.SECRET_KEY))
|
||||||
encrypted_data.encode()
|
decrypted_data = cipher_suite.decrypt(
|
||||||
) # Convert string back to bytes
|
encrypted_data.encode()
|
||||||
return decrypted_data.decode()
|
) # Convert string back to bytes
|
||||||
else:
|
return decrypted_data.decode()
|
||||||
|
else:
|
||||||
|
return ""
|
||||||
|
except Exception as e:
|
||||||
|
log_exception(e)
|
||||||
return ""
|
return ""
|
||||||
|
Loading…
Reference in New Issue
Block a user