diff --git a/ENV_SETUP.md b/ENV_SETUP.md index 3e03244c6..bfc300196 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/oauth.py b/apiserver/plane/app/views/oauth.py index 8a0396137..a0eb4973e 100644 --- a/apiserver/plane/app/views/oauth.py +++ b/apiserver/plane/app/views/oauth.py @@ -182,9 +182,19 @@ class OauthEndpoint(BaseAPIView): ) 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 bf6c23f9d..c2d369c2e 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/deploy/coolify/coolify-docker-compose.yml b/deploy/coolify/coolify-docker-compose.yml index 2a21c61a8..58e00a7a7 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 26be26ea5..8b4ff77ef 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 6be9ca2f4..4a3781811 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/space/.env.example b/space/.env.example deleted file mode 100644 index 7700ec946..000000000 --- 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/turbo.json b/turbo.json index ac0959c42..c5038525f 100644 --- a/turbo.json +++ b/turbo.json @@ -7,7 +7,6 @@ "NEXT_PUBLIC_SENTRY_DSN", "NEXT_PUBLIC_SENTRY_ENVIRONMENT", "NEXT_PUBLIC_ENABLE_SENTRY", - "NEXT_PUBLIC_ENABLE_OAUTH", "NEXT_PUBLIC_TRACK_EVENTS", "NEXT_PUBLIC_PLAUSIBLE_DOMAIN", "NEXT_PUBLIC_CRISP_ID", diff --git a/web/.env.example b/web/.env.example index 3868cd834..74d175cf8 100644 --- a/web/.env.example +++ b/web/.env.example @@ -1,4 +1,2 @@ -# Enable/Disable OAUTH - default 0 for selfhosted instance -NEXT_PUBLIC_ENABLE_OAUTH=0 # Public boards deploy URL NEXT_PUBLIC_DEPLOY_URL="http://localhost/spaces" \ No newline at end of file