LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
Oss login username set (#119)
ali45d0273994b3
diff --git a/backend/README.md b/backend/README.mdindex d668c5f90..db7224690 100644--- a/backend/README.md+++ b/backend/README.md@@ -36,13 +36,22 @@ python manage.py runserver localhost:8000- Server will start and run at port 8000. (<http://localhost:8000>)-## Default Username and Password+## Setting Username and PasswordThe default username is `unstract` and the default password is `unstract`.-To customize your password, simply navigate to the `.env` file and update the `DEFAULT_AUTH_PASSWORD` config before launching the server. Then use your new password to log in.+To customize your username or password:+1. Navigate to the `.env` file located at `backend`.+2. Update the values for `DEFAULT_AUTH_USERNAME` and `DEFAULT_AUTH_PASSWORD` with strong, unique credentials of your choosing.+3. Save the `.env` file and restart the server to apply changes.++> **NOTE**: The username `admin` is reserved for Django admin, hence cannot be used.++To update the username or password after it's been set:+1. Modify the username and password in `.env`.+2. Restart server to apply updates.+3. Login with the new credentials.-To update the password after it's been set, first change it in the .env file, restart the server for it to take effect, then log in using the new password.## Asynchronous execution/pipeline executiondiff --git a/backend/account/authentication_service.py b/backend/account/authentication_service.pyindex 2484571e9..d37ed473a 100644--- a/backend/account/authentication_service.py+++ b/backend/account/authentication_service.py@@ -82,6 +82,9 @@ class AuthenticationService:"""user = authenticate(request, username=username, password=password)if user:+ # To avoid conflicts with django superuser+ if user.is_superuser:+ return Falselogin(request, user)return True# Attempt to initiate default user and authenticate againdiff --git a/backend/account/constants.py b/backend/account/constants.pyindex 34c9a7726..ec246a361 100644--- a/backend/account/constants.py+++ b/backend/account/constants.py@@ -44,7 +44,7 @@ class ErrorMessage:class DefaultOrg:ORGANIZATION_NAME = "mock_org"MOCK_ORG = "mock_org"- MOCK_USER = "unstract"+ MOCK_USER = settings.DEFAULT_AUTH_USERNAMEMOCK_USER_ID = "mock_user_id"MOCK_USER_EMAIL = "[email protected]"MOCK_USER_PASSWORD = settings.DEFAULT_AUTH_PASSWORDdiff --git a/backend/backend/settings/base.py b/backend/backend/settings/base.pyindex c26883d41..555c33ba4 100644--- a/backend/backend/settings/base.py+++ b/backend/backend/settings/base.py@@ -140,6 +140,7 @@ WORKFLOW_DATA_DIR = os.environ.get("WORKFLOW_DATA_DIR")API_STORAGE_DIR = os.environ.get("API_STORAGE_DIR")CACHE_TTL_SEC = os.environ.get("CACHE_TTL_SEC", 10800)+DEFAULT_AUTH_USERNAME = os.environ.get("DEFAULT_AUTH_USERNAME", "unstract")DEFAULT_AUTH_PASSWORD = os.environ.get("DEFAULT_AUTH_PASSWORD", "unstract")# Quick-start development settings - unsuitable for productiondiff --git a/backend/sample.env b/backend/sample.envindex 9da40eeb5..ca94823e9 100644--- a/backend/sample.env+++ b/backend/sample.env@@ -108,5 +108,6 @@ ENCRYPTION_KEY="Sample-Key"# Cache TTLCACHE_TTL_SEC=10800-# Default user+# Default auth credentials+DEFAULT_AUTH_USERNAME=DEFAULT_AUTH_PASSWORD=diff --git a/run-platform.sh b/run-platform.shindex 6ed3519f9..ad2dd2232 100755--- a/run-platform.sh+++ b/run-platform.sh@@ -102,6 +102,8 @@ parse_args() {setup_env() {# Generate Fernet Key. Refer https://pypi.org/project/cryptography/. for both backend and platform-service.ENCRYPTION_KEY=$(python3 -c "import secrets, base64; print(base64.urlsafe_b64encode(secrets.token_bytes(32)).decode())")+ DEFAULT_AUTH_KEY="unstract"+for service in "${services[@]}"; dosample_env_path="$script_dir/$service/sample.env"env_path="$script_dir/$service/.env"@@ -113,6 +115,12 @@ setup_env() {echo -e "$blue_text""Adding encryption secret to $service""$default_text"echo "ENCRYPTION_KEY=\"$ENCRYPTION_KEY\"" >> $env_pathfi+ # Add default auth credentials for backend.+ if [ "$service" == "backend" ]; then+ echo -e "$blue_text""Adding default auth credentials to $service""$default_text"+ echo "DEFAULT_AUTH_USERNAME=\"$DEFAULT_AUTH_KEY\"" >> $env_path+ echo "DEFAULT_AUTH_PASSWORD=\"$DEFAULT_AUTH_KEY\"" >> $env_path+ fiecho -e "Created env for ""$blue_text""$service""$default_text" at ""$blue_text""$env_path""$default_text"."elseecho -e "Found existing env for ""$blue_text""$service""$default_text" at ""$blue_text""$env_path""$default_text"."