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

Closed
opened 2026-03-15 01:47:25 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ArchiveBox/ArchiveBox/pull/1726
Author: @pirate
Created: 12/29/2025
Status: Merged
Merged: 12/29/2025
Merged by: @pirate

Base: devHead: claude/issue-1707-20251229-2144


📝 Commits (1)

  • 2e1093f fix: Use CustomUserAdmin instead of Django's default UserAdmin to fix user creation bug

📊 Changes

2 files changed (+8 additions, -2 deletions)

View changed files

📝 archivebox/core/admin.py (+2 -2)
📝 archivebox/core/admin_users.py (+6 -0)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ArchiveBox/ArchiveBox/pull/1726 **Author:** [@pirate](https://github.com/pirate) **Created:** 12/29/2025 **Status:** ✅ Merged **Merged:** 12/29/2025 **Merged by:** [@pirate](https://github.com/pirate) **Base:** `dev` ← **Head:** `claude/issue-1707-20251229-2144` --- ### 📝 Commits (1) - [`2e1093f`](https://github.com/ArchiveBox/ArchiveBox/commit/2e1093f8409dbe426a116a7979e69ece046966a1) fix: Use CustomUserAdmin instead of Django's default UserAdmin to fix user creation bug ### 📊 Changes **2 files changed** (+8 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `archivebox/core/admin.py` (+2 -2) 📝 `archivebox/core/admin_users.py` (+6 -0) </details> ### 📄 Description ### 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. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-15 01:47:25 +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#4490
No description provided.