diff --git a/backend/app/templates/setup.html b/backend/app/templates/setup.html index 0e7b590..dac8b12 100644 --- a/backend/app/templates/setup.html +++ b/backend/app/templates/setup.html @@ -3,205 +3,293 @@ - Setup – {{ app_name }} + Setup - {{ app_name }} + + + + + - -
- - -
- - {{ app_name }} logo - {{ app_name }} - -

First-run Setup

-

Configure Logto to enable user authentication.

-
- - {% if logto_configured %} - -
-
- + - {% endif %} + - -
- - -
-
-

- 1 - Deploy or sign up for Logto -

-

- Choose one of the options below. Both are free to start. +

+
+
+

First-run setup

+

+ Save the basic settings DMARQ needs before the dashboard is used.

-
-
-

☁️ Logto Cloud (recommended)

-

- Sign up at - cloud.logto.io. - The free tier supports unlimited users. -

+
+ +
+
+
    + +
+ +
+ + Checking setup status...
-
-

🐳 Self-hosted (Docker)

-

- Add Logto to your docker-compose.yml - (see the - Logto deployment guide). -

+ + + +
+
+

Admin contact

+

This contact is saved with the setup record.

+
+ +
+ + + + +
+ +
+ +
+
+ +
+
+

System settings

+

These values are stored in the application settings.

+
+ +
+ + +
+ +
+ + +
+
+ +
+ +
-
+
- -
-
-

- 2 - Create a "Traditional Web" application in Logto -

-
    -
  1. Open the Logto ConsoleApplicationsCreate application.
  2. -
  3. Choose Traditional Web.
  4. -
  5. Enter a name, e.g. DMARQ.
  6. -
  7. - Set the Redirect URI to:
    - - <your-dmarq-url>/api/v1/auth/callback - -
  8. -
  9. - Set the Post Sign-out Redirect URI to:
    - - <your-dmarq-url>/login - -
  10. -
  11. Save and note the App ID and App Secret.
  12. -
-
-
- - -
-
-

- 3 - Set environment variables and restart {{ app_name }} -

-

- Add the following to your .env file or Docker environment: -

-
-
# Logto endpoint – the base URL of your Logto instance
-LOGTO_ENDPOINT=https://<your-tenant>.logto.app
-
-# Application credentials from the Logto Console
-LOGTO_APP_ID=<your-app-id>
-LOGTO_APP_SECRET=<your-app-secret>
-
-# Optional: override the callback URL (defaults to <base_url>/api/v1/auth/callback)
-# LOGTO_REDIRECT_URI=https://dmarc.example.com/api/v1/auth/callback
-
- - -
-
-

- 4 - (Optional) Add authentication providers in Logto -

-

- Logto lets you enable social providers (Google, GitHub, Microsoft, …), - SMS / email passwordless, and multi-factor authentication entirely through - its console – no code changes needed in {{ app_name }}. -

-

- See the - Logto connector docs - for details. -

-
-
- - -
-
-

- - - - Alternative: disable authentication entirely -

-

- If you're running {{ app_name }} locally or behind a trusted reverse proxy that - already handles authentication, you can skip Logto and grant everyone full access - by setting: -

-
-
AUTH_DISABLED=true
-
- - - {% if logto_configured %} - - {% endif %} - -
+ +
diff --git a/backend/app/tests/test_setup_endpoints.py b/backend/app/tests/test_setup_endpoints.py index ae9740e..caa8c5a 100644 --- a/backend/app/tests/test_setup_endpoints.py +++ b/backend/app/tests/test_setup_endpoints.py @@ -76,6 +76,24 @@ class TestSetupStatus: assert data["app_name"] == "Persisted DMARQ" +class TestSetupPage: + """Tests for the rendered setup page.""" + + def test_setup_page_renders_guided_wizard(self): + from app.main import app as main_app + + with TestClient(main_app) as test_client: + response = test_client.get("/setup") + + assert response.status_code == 200 + assert "First-run setup" in response.text + assert '@submit.prevent="submitAdmin"' in response.text + assert '@submit.prevent="submitSystem"' in response.text + assert "/api/v1/setup/status" in response.text + assert "/api/v1/setup/admin" in response.text + assert "/api/v1/setup/system" in response.text + + class TestSetupAdmin: """Tests for POST /api/v1/setup/admin"""