[PR #1726] fix: Use CustomUserAdmin to fix user creation bug #2987

Closed
opened 2026-03-01 18:01:19 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/ArchiveBox/ArchiveBox/pull/1726

State: closed
Merged: Yes


Summary

Fixed the bug where users created via the web GUI cannot login.

Root Cause

The issue was in archivebox/core/admin.py which imported and registered Django's default UserAdmin instead of the custom CustomUserAdmin class. This bypassed all custom admin logic. Additionally, CustomUserAdmin was modifying fieldsets without explicitly preserving add_fieldsets, which could cause Django to not properly handle the user creation form.

Changes

  • Updated admin.py to import and register CustomUserAdmin
  • Explicitly set add_fieldsets in CustomUserAdmin to preserve Django's default user creation behavior
  • Added explanatory comments

Testing

To verify the fix:

  1. Start ArchiveBox web server
  2. Navigate to the admin user creation page (/admin/auth/user/add/)
  3. Create a new user with staff and superuser permissions
  4. Log out and attempt to log in with the new user's credentials
  5. Login should now succeed

Fixes #1707

Generated with Claude Code


Summary by cubic

Fixed the bug where users created in the admin couldn’t log in. New users are now created with the correct form and password handling.

  • Bug Fixes
    • Register CustomUserAdmin instead of Django’s default UserAdmin.
    • Preserve add_fieldsets to keep the default user creation form and password hashing.
    • Apply extra fieldsets only to the change form, not the creation form.

Written for commit 2e1093f840. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/ArchiveBox/ArchiveBox/pull/1726 **State:** closed **Merged:** Yes --- ### Summary Fixed the bug where users created via the web GUI cannot login. ### Root Cause The issue was in `archivebox/core/admin.py` which imported and registered Django's default `UserAdmin` instead of the custom `CustomUserAdmin` class. This bypassed all custom admin logic. Additionally, `CustomUserAdmin` was modifying `fieldsets` without explicitly preserving `add_fieldsets`, which could cause Django to not properly handle the user creation form. ### Changes - Updated `admin.py` to import and register `CustomUserAdmin` - Explicitly set `add_fieldsets` in `CustomUserAdmin` to preserve Django's default user creation behavior - Added explanatory comments ### Testing To verify the fix: 1. Start ArchiveBox web server 2. Navigate to the admin user creation page (`/admin/auth/user/add/`) 3. Create a new user with staff and superuser permissions 4. Log out and attempt to log in with the new user's credentials 5. Login should now succeed Fixes #1707 Generated with [Claude Code](https://claude.ai/code) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixed the bug where users created in the admin couldn’t log in. New users are now created with the correct form and password handling. - **Bug Fixes** - Register CustomUserAdmin instead of Django’s default UserAdmin. - Preserve add_fieldsets to keep the default user creation form and password hashing. - Apply extra fieldsets only to the change form, not the creation form. <sup>Written for commit 2e1093f8409dbe426a116a7979e69ece046966a1. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
kerem 2026-03-01 18:01:19 +03:00
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/ArchiveBox#2987
No description provided.