diff --git a/memos/config.py b/memos/config.py index 650062e..e53f96f 100644 --- a/memos/config.py +++ b/memos/config.py @@ -70,8 +70,8 @@ class Settings(BaseSettings): # Embedding settings embedding: EmbeddingSettings = EmbeddingSettings() - auth_username: str = "admin" - auth_password: SecretStr = SecretStr("changeme") + auth_username: str = "" + auth_password: SecretStr = SecretStr("") default_plugins: List[str] = ["builtin_ocr"] diff --git a/memos/default_config.yaml b/memos/default_config.yaml index b32cb8a..1bcb0f5 100644 --- a/memos/default_config.yaml +++ b/memos/default_config.yaml @@ -6,8 +6,10 @@ screenshots_dir: screenshots server_host: 0.0.0.0 server_port: 8839 -auth_username: admin -auth_password: changeme +# Enable authentication by uncommenting the following lines +# auth_username: admin +# auth_password: changeme + default_plugins: - builtin_ocr # - builtin_vlm diff --git a/memos/server.py b/memos/server.py index 79c9047..9871098 100644 --- a/memos/server.py +++ b/memos/server.py @@ -96,6 +96,7 @@ def is_auth_enabled(): def authenticate(credentials: HTTPBasicCredentials = Depends(security)): if not is_auth_enabled(): + logging.info("Authentication is disabled - no username/password configured") return None correct_username = compare_digest(credentials.username, settings.auth_username) correct_password = compare_digest( @@ -117,7 +118,7 @@ def optional_auth(credentials: HTTPBasicCredentials = Depends(security)): @app.get("/") -async def serve_spa(): +async def serve_spa(username: str = Depends(optional_auth)): return FileResponse(os.path.join(current_dir, "static/app.html"))