diff --git a/ENV_SETUP.md b/ENV_SETUP.md index 3e03244c66f..bfc30019624 100644 --- a/ENV_SETUP.md +++ b/ENV_SETUP.md @@ -49,24 +49,10 @@ NGINX_PORT=80 ​ ``` -# Enable/Disable OAUTH - default 0 for selfhosted instance -NEXT_PUBLIC_ENABLE_OAUTH=0 # Public boards deploy URL NEXT_PUBLIC_DEPLOY_URL="http://localhost/spaces" ``` -​ - -## {PROJECT_FOLDER}/spaces/.env.example - -​ - -``` -# Flag to toggle OAuth -NEXT_PUBLIC_ENABLE_OAUTH=0 -``` - -​ ## {PROJECT_FOLDER}/apiserver/.env diff --git a/apiserver/plane/app/views/authentication.py b/apiserver/plane/app/views/authentication.py index 811eeb9599f..2564463132b 100644 --- a/apiserver/plane/app/views/authentication.py +++ b/apiserver/plane/app/views/authentication.py @@ -343,13 +343,6 @@ def post(self, request): if str(token) == str(user_token): user = User.objects.get(email=email) - if not user.is_active: - return Response( - { - "error": "Your account has been deactivated. Please contact your site administrator." - }, - status=status.HTTP_403_FORBIDDEN, - ) # Send event auth_events.delay( user=user.id, diff --git a/apiserver/plane/app/views/oauth.py b/apiserver/plane/app/views/oauth.py index 8a03961373d..de90e433740 100644 --- a/apiserver/plane/app/views/oauth.py +++ b/apiserver/plane/app/views/oauth.py @@ -167,12 +167,6 @@ def post(self, request): ] ) - if not GOOGLE_CLIENT_ID or not GITHUB_CLIENT_ID: - return Response( - {"error": "Github or Google login is not configured"}, - status=status.HTTP_400_BAD_REQUEST, - ) - if not medium or not id_token: return Response( { @@ -182,9 +176,19 @@ def post(self, request): ) if medium == "google": + if not GOOGLE_CLIENT_ID: + return Response( + {"error": "Google login is not configured"}, + status=status.HTTP_400_BAD_REQUEST, + ) data = validate_google_token(id_token, client_id) if medium == "github": + if not GITHUB_CLIENT_ID: + return Response( + {"error": "Github login is not configured"}, + status=status.HTTP_400_BAD_REQUEST, + ) access_token = get_access_token(id_token, client_id) data = get_user_data(access_token) diff --git a/apiserver/plane/license/utils/encryption.py b/apiserver/plane/license/utils/encryption.py index bf6c23f9d76..c2d369c2e19 100644 --- a/apiserver/plane/license/utils/encryption.py +++ b/apiserver/plane/license/utils/encryption.py @@ -9,14 +9,20 @@ def derive_key(secret_key): dk = hashlib.pbkdf2_hmac('sha256', secret_key.encode(), b'salt', 100000) return base64.urlsafe_b64encode(dk) - +# Encrypt data def encrypt_data(data): - cipher_suite = Fernet(derive_key(settings.SECRET_KEY)) - encrypted_data = cipher_suite.encrypt(data.encode()) - return encrypted_data.decode() # Convert bytes to string - + 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 "" +# Decrypt data def decrypt_data(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() + 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 "" \ No newline at end of file diff --git a/apiserver/plane/urls.py b/apiserver/plane/urls.py index 75b4c2609d0..e437da0787f 100644 --- a/apiserver/plane/urls.py +++ b/apiserver/plane/urls.py @@ -19,8 +19,11 @@ if settings.DEBUG: - import debug_toolbar - - urlpatterns = [ - re_path(r"^__debug__/", include(debug_toolbar.urls)), - ] + urlpatterns + try: + import debug_toolbar + + urlpatterns = [ + re_path(r"^__debug__/", include(debug_toolbar.urls)), + ] + urlpatterns + except ImportError: + pass diff --git a/deploy/coolify/coolify-docker-compose.yml b/deploy/coolify/coolify-docker-compose.yml index 2a21c61a877..58e00a7a715 100644 --- a/deploy/coolify/coolify-docker-compose.yml +++ b/deploy/coolify/coolify-docker-compose.yml @@ -7,7 +7,6 @@ services: restart: always command: /usr/local/bin/start.sh web/server.js web environment: - - NEXT_PUBLIC_ENABLE_OAUTH=${NEXT_PUBLIC_ENABLE_OAUTH:-0} - NEXT_PUBLIC_DEPLOY_URL=$SERVICE_FQDN_SPACE_8082 depends_on: - api @@ -21,7 +20,6 @@ services: command: /usr/local/bin/start.sh space/server.js space environment: - SERVICE_FQDN_SPACE_8082=/api - - NEXT_PUBLIC_ENABLE_OAUTH=${NEXT_PUBLIC_ENABLE_OAUTH:-0} depends_on: - api - worker diff --git a/deploy/selfhost/docker-compose.yml b/deploy/selfhost/docker-compose.yml index 26be26ea5a6..8b4ff77ef02 100644 --- a/deploy/selfhost/docker-compose.yml +++ b/deploy/selfhost/docker-compose.yml @@ -6,7 +6,6 @@ x-app-env : &app-env - WEB_URL=${WEB_URL:-http://localhost} - DEBUG=${DEBUG:-0} - DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE:-plane.settings.production} # deprecated - - NEXT_PUBLIC_ENABLE_OAUTH=${NEXT_PUBLIC_ENABLE_OAUTH:-0} # deprecated - NEXT_PUBLIC_DEPLOY_URL=${NEXT_PUBLIC_DEPLOY_URL:-http://localhost/spaces} # deprecated - SENTRY_DSN=${SENTRY_DSN:-""} - SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT:-"production"} diff --git a/deploy/selfhost/variables.env b/deploy/selfhost/variables.env index 6be9ca2f49e..4a378181154 100644 --- a/deploy/selfhost/variables.env +++ b/deploy/selfhost/variables.env @@ -7,7 +7,6 @@ API_REPLICAS=1 NGINX_PORT=80 WEB_URL=http://localhost DEBUG=0 -NEXT_PUBLIC_ENABLE_OAUTH=0 NEXT_PUBLIC_DEPLOY_URL=http://localhost/spaces SENTRY_DSN="" SENTRY_ENVIRONMENT="production" diff --git a/packages/editor/core/package.json b/packages/editor/core/package.json index 9fca82e36c0..2f458995c73 100644 --- a/packages/editor/core/package.json +++ b/packages/editor/core/package.json @@ -55,7 +55,7 @@ "highlight.js": "^11.8.0", "jsx-dom-cjs": "^8.0.3", "lowlight": "^3.0.0", - "lucide-react": "^0.244.0", + "lucide-react": "^0.294.0", "react-moveable": "^0.54.2", "tailwind-merge": "^1.14.0", "tippy.js": "^6.3.7", diff --git a/packages/editor/extensions/package.json b/packages/editor/extensions/package.json index 65632e4963b..48abd770155 100644 --- a/packages/editor/extensions/package.json +++ b/packages/editor/extensions/package.json @@ -28,16 +28,16 @@ "react-dom": "18.2.0" }, "dependencies": { - "@tiptap/react": "^2.1.7", + "@plane/editor-core": "*", + "@plane/editor-types": "*", "@tiptap/core": "^2.1.7", + "@tiptap/pm": "^2.1.7", + "@tiptap/react": "^2.1.7", "@tiptap/suggestion": "^2.0.4", - "@plane/editor-types": "*", - "@plane/editor-core": "*", "eslint": "8.36.0", "eslint-config-next": "13.2.4", - "lucide-react": "^0.293.0", - "tippy.js": "^6.3.7", - "@tiptap/pm": "^2.1.7" + "lucide-react": "^0.294.0", + "tippy.js": "^6.3.7" }, "devDependencies": { "@types/node": "18.15.3", diff --git a/packages/editor/rich-text-editor/package.json b/packages/editor/rich-text-editor/package.json index e960f28276c..baac553b811 100644 --- a/packages/editor/rich-text-editor/package.json +++ b/packages/editor/rich-text-editor/package.json @@ -30,11 +30,11 @@ }, "dependencies": { "@plane/editor-core": "*", - "@tiptap/core": "^2.1.11", - "@plane/editor-types": "*", "@plane/editor-extensions": "*", + "@plane/editor-types": "*", + "@tiptap/core": "^2.1.11", "@tiptap/extension-placeholder": "^2.1.11", - "lucide-react": "^0.244.0" + "lucide-react": "^0.294.0" }, "devDependencies": { "@types/node": "18.15.3", diff --git a/space/.env.example b/space/.env.example deleted file mode 100644 index 7700ec94660..00000000000 --- a/space/.env.example +++ /dev/null @@ -1,2 +0,0 @@ -# Flag to toggle OAuth -NEXT_PUBLIC_ENABLE_OAUTH=0 \ No newline at end of file diff --git a/space/components/accounts/github-login-button.tsx b/space/components/accounts/github-sign-in.tsx similarity index 93% rename from space/components/accounts/github-login-button.tsx rename to space/components/accounts/github-sign-in.tsx index 46e4cd18db7..322011ae3c2 100644 --- a/space/components/accounts/github-login-button.tsx +++ b/space/components/accounts/github-sign-in.tsx @@ -8,12 +8,12 @@ import { useTheme } from "next-themes"; import githubBlackImage from "public/logos/github-black.svg"; import githubWhiteImage from "public/logos/github-white.svg"; -export interface GithubLoginButtonProps { +type Props = { handleSignIn: React.Dispatch; clientId: string; -} +}; -export const GithubLoginButton: FC = (props) => { +export const GitHubSignInButton: FC = (props) => { const { handleSignIn, clientId } = props; // states const [loginCallBackURL, setLoginCallBackURL] = useState(undefined); diff --git a/space/components/accounts/google-login.tsx b/space/components/accounts/google-sign-in.tsx similarity index 87% rename from space/components/accounts/google-login.tsx rename to space/components/accounts/google-sign-in.tsx index 707aec919ca..3d637e949ca 100644 --- a/space/components/accounts/google-login.tsx +++ b/space/components/accounts/google-sign-in.tsx @@ -1,12 +1,12 @@ import { FC, useEffect, useRef, useCallback, useState } from "react"; import Script from "next/script"; -export interface IGoogleLoginButton { +type Props = { clientId: string; handleSignIn: React.Dispatch; -} +}; -export const GoogleLoginButton: FC = (props) => { +export const GoogleSignInButton: FC = (props) => { const { handleSignIn, clientId } = props; // refs const googleSignInButton = useRef(null); @@ -30,6 +30,7 @@ export const GoogleLoginButton: FC = (props) => { size: "large", logo_alignment: "center", text: "signin_with", + width: 384, } as GsiButtonConfiguration // customization attributes ); } catch (err) { @@ -53,7 +54,7 @@ export const GoogleLoginButton: FC = (props) => { return ( <>