Deleting users fails if password was changed #1199

Open
opened 2026-02-20 15:29:31 -05:00 by deekerman · 0 comments
Owner

Originally created by @jschirrmacher on GitHub (Mar 15, 2020).

Originally assigned to: @NGPixel on GitHub.

Describe the bug
If users change their password, it is not possible to delete this users any more, even they never created a page or anything else. Instead, I get a foreign constraint error in the logs:

ERROR:  update or delete on table "users" violates foreign key constraint "userkeys_userid_foreign" on table "userKeys"
DETAIL:  Key (id)=(18) is still referenced from table "userKeys".

Actually, the userKey generated for this user was already long outdated (several days), so this token was not valid any more.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new user and login as this user.
  2. Change the password and log out again.
  3. Log in as administrator, and go to user administration page
  4. Try to delete the first user.

Expected behavior
The user should be deleted, and the token should be removed with the user (cascading). User deletion should work.

Host Info (please complete the following information):

  • OS: Docker
  • Wiki.js version: 2.1.113
  • Database engine: postgres:9-alpine
Originally created by @jschirrmacher on GitHub (Mar 15, 2020). Originally assigned to: @NGPixel on GitHub. **Describe the bug** If users change their password, it is not possible to delete this users any more, even they never created a page or anything else. Instead, I get a foreign constraint error in the logs: ``` ERROR: update or delete on table "users" violates foreign key constraint "userkeys_userid_foreign" on table "userKeys" DETAIL: Key (id)=(18) is still referenced from table "userKeys". ``` Actually, the userKey generated for this user was already long outdated (several days), so this token was not valid any more. **To Reproduce** Steps to reproduce the behavior: 1. Create a new user and login as this user. 2. Change the password and log out again. 3. Log in as administrator, and go to user administration page 4. Try to delete the first user. **Expected behavior** The user should be deleted, and the token should be removed with the user (cascading). User deletion should work. **Host Info (please complete the following information):** - OS: Docker - Wiki.js version: 2.1.113 - Database engine: postgres:9-alpine
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/wiki#1199
No description provided.