fix(desec): reuse an existing slug the user already owns

Logging in with an existing deSEC account and entering a slug you already
own failed with "Domain limit exceeded": registerDomain() always tried to
POST /domains/, which deSEC rejects (403 when the account is at its quota,
400/409 when the name is taken) even though the domain belongs to you.

Now, for a user-specified slug, a 400/403/409 triggers an ownership check
(GET /domains/{name}/); if the account already owns the domain it is reused
and registration completes. Otherwise a clear message is shown (over-limit
vs. taken by someone else). Random-slug registration is unchanged.

Update the deSEC mock to mirror the real status codes (per-account ownership,
domain limit -> 403, taken name -> 400, GET /domains/{name}/) and add a spec
that exercises the over-limit ownership-recovery path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Simon L. <szaimen@e.mail.de>
This commit is contained in:
Simon L.
2026-06-22 15:19:42 +02:00
parent b5e35c90d8
commit 9cfd5b41f6
5 changed files with 174 additions and 9 deletions
+2
View File
@@ -186,6 +186,8 @@ jobs:
if ! npx playwright test tests/desec-register.spec.js; then dump_logs; exit 1; fi
reseed
if ! npx playwright test tests/desec-existing.spec.js; then dump_logs; exit 1; fi
reseed
if ! npx playwright test tests/desec-existing-slug.spec.js; then dump_logs; exit 1; fi
kill "$(cat "$GITHUB_WORKSPACE/desec-mock.pid")" || true
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
@@ -141,6 +141,8 @@ jobs:
if ! npx playwright test tests/desec-register.spec.js; then dump_logs; exit 1; fi
reseed
if ! npx playwright test tests/desec-existing.spec.js; then dump_logs; exit 1; fi
reseed
if ! npx playwright test tests/desec-existing-slug.spec.js; then dump_logs; exit 1; fi
kill "$(cat "$GITHUB_WORKSPACE/desec-mock.pid")" || true
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1