feat(account): self-service account deletion, MODULE_API 1.20.0 #232
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/account-deletion"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Step 2 of
docs/website/ACCOUNT_DELETION.md§6, the core: a member deletes their own account on the website, and the admin route's delete runs the same procedure. Play needs this before the M8 cutover (android/PLAN.md). Docs: RunicGateway/docs PR ondocs/account-deletion-core.The route
DELETE /api/v1/auth/me/accounttakes{ username, password, code?, recoveryCode? }.code:username_mismatch,wrong_password,code_required,wrong_codepassword_required,last_adminDEMO_LOCKEDfor the demo's shared loginsTokenAuthenticatorrefresh and replay the DELETE. Both failures count toward the login backoff and bot score, like a wrong current password does elsewhere.backoffGuard,slowLoginandaccountChangeLimiter. Swagger annotations are added and the spec is regenerated.The procedure (
server/src/auth/accountDeletion.js)onUserDeleting({ userId, deletedBy })runs in turn, each with a 10 s limit. A hook that throws or hangs is logged, and the deletion goes ahead (AD10, AD11).transaction()inutils/db.js): a staff username goes into the newreserved_usernamestable (AD9), and the row is deleted. The foreign keys do the rest.user.self_deleteoruser.deletein the activity log, naming the id and never the usernameauth.account-deletedThe admin
DELETE /admin/users/:idnow calls the same service and keeps its 400s.MODULE_API 1.20.0
api.onUserDeleting(fn)is added on the server, the version is bumped on both halves, and the engagement manifest is regenerated. Module-uo's^1.10.0still resolves. With no hook registered, a deletion is just the cascade, as before. The Integration Kit'scoreApicheck goes red until it's re-pinned, which is intended.Who sees a deleted account's name (AD5, AD6)
server/src/utils/displayAuthor.jsis the one rule:…Deletedflag. The client shows that as "Ravenna (deleted account)".It's used by:
A deleted account drops off Forum guests (AD13, asked today). Its grant row stays in the staff ledger.
Reserved names (AD9)
users.modelrefuses a reserved name increateUserand in a usernameupdate.isDuplicateUsernamereports that refusal as a duplicate. So registration, invite acceptance, SSO provisioning, an admin creating or renaming an account, and a self-service rename all answer it the way they answer a taken name.Web
lib/notice.jsfeeds the existing toast).Checked
npm test(server): 2,356 tests, 0 failures. New test files:accountDeletion,displayAuthor,userDeletingHook. Updated:contentReports,demoLocks,emailTemplates,eventModuleContract.npm test443/443,npm run buildpasses.routes.manifest.jsonwas regenerated with no modules installed: one route added.acctdelon the dev MariaDB), with no game module:/accountthen went to sign-in.DEMO_MODE)Not in this PR (later steps)
Module-uo and Module-Rust hooks (step 3)
Android (step 4)
runicgateway.com
/delete-account/(step 5)AI-assisted (Claude Code)
🤖 Generated with Claude Code
https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
ACCOUNT_DELETION.md phase 2 (core): a member deletes their own account on the website, and the admin route runs the same procedure. - DELETE /api/v1/auth/me/account: typed username, password always (AD7), and a 2FA or recovery code when 2FA is on. A wrong password or code is 400, not 401 (AD12), so the app's refresh-on-401 never replays it. 409 password_required and last_admin; the demo's shared logins are locked. - auth/accountDeletion.js: module hooks first, then one transaction that reserves a staff username (reserved_usernames, AD9) and deletes the row, then a Teams reconcile, the audit entry (no username) and a notice to the old address (new protected template auth.account-deleted). - MODULE_API 1.20.0: api.onUserDeleting({ userId, deletedBy }), before the delete, 10 s limit, cannot veto (AD10, AD11). - utils/displayAuthor.js: a deleted account's username snapshots read "[deleted player]" to members and the stored name, marked, to staff (AD5, AD6). Used by the forum, the Reports queue, the guest list and the Team digest. A deleted account drops off Forum guests (AD13). - Reserved names refuse at every username write, answered as "taken". - Web: Delete my account on the player and staff Account pages; staff views mark "(deleted account)". - OpenAPI regenerated; route manifest and engagement manifest regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY