Operators can fix prod admin passwords without email via Byt lösenord; end users can use forgot-password when SMTP is configured. Local and CI use Mailpit to capture outbound mail and verify reset links end-to-end. - Backend: V8 password_reset_tokens, PasswordResetService, EmailService, POST /api/auth/forgot-password, reset-password, change-password - Optional testToken in forgot-password response (docker profile only, for E2E) - Frontend: ForgotPasswordPage, ResetPasswordPage, ChangePasswordPage, routes, login link, header Byt lösenord - Mailpit (ghcr.io/axllent/mailpit:v1.28) in docker-compose + e2e stack - E2E: password-reset.spec.ts + Mailpit API helper tests SMTP delivery - Separate dev/e2e Docker image names to avoid overwriting bilhej-frontend - Docs: README email section, production-email-checklist, .env.example - Unit/integration tests for reset, change password, and Vitest page specs Co-authored-by: Cursor <cursoragent@cursor.com>
102 lines
2.5 KiB
YAML
102 lines
2.5 KiB
YAML
networks:
|
|
e2e:
|
|
driver: bridge
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
container_name: bilhej-postgres-e2e
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
networks:
|
|
- e2e
|
|
tmpfs:
|
|
- /var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
mailpit:
|
|
image: ghcr.io/axllent/mailpit:v1.28
|
|
container_name: bilhej-mailpit-e2e
|
|
networks:
|
|
- e2e
|
|
|
|
backend:
|
|
image: bilhej-backend-e2e
|
|
build:
|
|
dockerfile: docker/backend.e2e.Dockerfile
|
|
context: .
|
|
container_name: bilhej-backend-e2e
|
|
environment:
|
|
SPRING_PROFILES_ACTIVE: docker
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
JWT_SECRET: ${JWT_SECRET}
|
|
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY}
|
|
STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET}
|
|
STRIPE_PRICE_ID: ${STRIPE_PRICE_ID}
|
|
APP_PUBLIC_BASE_URL: http://frontend
|
|
MAIL_HOST: mailpit
|
|
MAIL_PORT: "1025"
|
|
MAIL_USERNAME: ""
|
|
MAIL_PASSWORD: ""
|
|
MAIL_FROM: noreply@bilhej.se
|
|
networks:
|
|
- e2e
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
mailpit:
|
|
condition: service_started
|
|
|
|
frontend:
|
|
image: bilhej-frontend-e2e
|
|
build:
|
|
dockerfile: docker/frontend.e2e.Dockerfile
|
|
context: .
|
|
container_name: bilhej-frontend-e2e
|
|
networks:
|
|
- e2e
|
|
depends_on:
|
|
- backend
|
|
|
|
playwright:
|
|
image: bilhej-playwright-e2e
|
|
build:
|
|
dockerfile: docker/playwright.e2e.Dockerfile
|
|
context: .
|
|
container_name: bilhej-playwright-e2e
|
|
ipc: host
|
|
environment:
|
|
PLAYWRIGHT_BASE_URL: http://frontend
|
|
MAILPIT_API_URL: http://mailpit:8025
|
|
networks:
|
|
- e2e
|
|
depends_on:
|
|
- frontend
|
|
- mailpit
|
|
command: >-
|
|
sh -c "
|
|
echo 'Waiting for mailpit...';
|
|
for i in \$(seq 1 30); do
|
|
curl -sf http://mailpit:8025/api/v1/info > /dev/null && break;
|
|
sleep 1;
|
|
done;
|
|
echo 'Waiting for backend...';
|
|
for i in \$(seq 1 60); do
|
|
curl -s http://backend:8080/api/vehicles/ZZZ999 > /dev/null && break;
|
|
sleep 1;
|
|
done;
|
|
echo 'Waiting for frontend...';
|
|
for i in \$(seq 1 30); do
|
|
curl -s http://frontend > /dev/null && break;
|
|
sleep 1;
|
|
done;
|
|
npx playwright test --reporter=list
|
|
"
|