Goal
Remove the library-authentication feature (log in / gate access via a Library — IP ranges, card patterns, library admin) that Eric approved retiring. This issue scopes it, because the naive "delete the libraryauth app" is not what's needed.
Key finding — libraryauth holds the site's core login, not just library auth
The regluit.libraryauth app is misnamed for its current role: alongside the library feature it contains the main authentication machinery used site-wide. Deleting the app would break all login. The pieces split into two groups:
A. Shared / core auth — MUST be kept (relocate, don't delete)
| Symbol |
File |
Used by |
superlogin, login_user, Authenticator |
libraryauth/views.py |
frontend/views/__init__.py:122 — the main site login |
UserNamePass |
libraryauth/forms.py |
frontend/views/__init__.py:121 — main login form |
selective_social_user, chop_username, selectively_associate_by_email, deliver_extra_data |
libraryauth/auth.py |
SOCIAL_AUTH_PIPELINE (settings/common.py:320-348) — all social login |
SocialAuthExceptionMiddlewareWithoutMessages |
libraryauth/auth.py |
MIDDLEWARE (settings/common.py:148) |
pic_storage_url, AVATARS |
libraryauth/auth.py |
core/models/__init__.py:40, core/management/commands/fix_avatars.py — avatars |
B. Library-specific — the actual removal target
- Models (
libraryauth/models.py): Library, IP / IPAddressFormField / IPAddressModelField, Block, CardPattern, LibraryUser, EmailPattern, BadUsernamePattern
- Views:
join_library, library, UpdateLibraryView, login_as_library, library_users, library_admin, etc.
- URLs (
libraryauth/urls.py): the ^libraryauth/<id>/… routes
- Templates:
libraryauth/templates/libraryauth/*
- External consumers to update:
Library is imported in core/models/__init__.py:41, frontend/forms/__init__.py:42, frontend/views/__init__.py:123; LibraryUser in core/signals.py:33; core/tests.py:1205 references the Library model.
Proposed staged plan (each a reviewable PR, validated on test.unglue.it)
- Decouple the shared auth glue (behavior-preserving). Move group A out of
libraryauth into a non-library home (e.g. core/auth.py / keep a thin module), update the settings pipeline/middleware paths and the frontend imports. No feature change; the riskiest step for login, so validate social + password login on staging before merge.
- Remove the library UI surface. Drop the
^libraryauth/… URLs, the library views, and templates; remove Library/library imports from frontend and core (guard any is_free/access-check call sites that consulted library access).
- Remove the library models + data. Delete
Library, LibraryUser, Block, CardPattern, EmailPattern, BadUsernamePattern, IP fields; add the Django migration to drop the tables. (LibraryUser also interacts with core/signals.py — handle the signal.)
- Settings + cleanup. Once B is gone and A is relocated, drop
'regluit.libraryauth' from INSTALLED_APPS (or shrink the app to the relocated shared bits) and remove dead templates/tests.
Risks / notes
- Auth is the blast radius. Step 1 touches the login path for every user; needs staging validation (test.unglue.it), not local-only.
- There may be access-control call sites (library-gated downloads /
lib_acqs, Hold/library holds) that assume Library exists — audit those before step 2/3.
- Related but distinct: the
handle_same_email_account dedup signal in libraryauth/signals.py (see libraryauth_dedup_impact.md) — decide keep/relocate as part of step 1.
Ask
Confirm the scope (remove feature B, preserve/relocate A) before the first PR lands, given step 1 rewires the core login path. PRs will be opened against master and validated on test.unglue.it.
Goal
Remove the library-authentication feature (log in / gate access via a Library — IP ranges, card patterns, library admin) that Eric approved retiring. This issue scopes it, because the naive "delete the
libraryauthapp" is not what's needed.Key finding —
libraryauthholds the site's core login, not just library authThe
regluit.libraryauthapp is misnamed for its current role: alongside the library feature it contains the main authentication machinery used site-wide. Deleting the app would break all login. The pieces split into two groups:A. Shared / core auth — MUST be kept (relocate, don't delete)
superlogin,login_user,Authenticatorlibraryauth/views.pyfrontend/views/__init__.py:122— the main site loginUserNamePasslibraryauth/forms.pyfrontend/views/__init__.py:121— main login formselective_social_user,chop_username,selectively_associate_by_email,deliver_extra_datalibraryauth/auth.pySOCIAL_AUTH_PIPELINE(settings/common.py:320-348) — all social loginSocialAuthExceptionMiddlewareWithoutMessageslibraryauth/auth.pyMIDDLEWARE(settings/common.py:148)pic_storage_url,AVATARSlibraryauth/auth.pycore/models/__init__.py:40,core/management/commands/fix_avatars.py— avatarsB. Library-specific — the actual removal target
libraryauth/models.py):Library,IP/IPAddressFormField/IPAddressModelField,Block,CardPattern,LibraryUser,EmailPattern,BadUsernamePatternjoin_library,library,UpdateLibraryView,login_as_library,library_users,library_admin, etc.libraryauth/urls.py): the^libraryauth/<id>/…routeslibraryauth/templates/libraryauth/*Libraryis imported incore/models/__init__.py:41,frontend/forms/__init__.py:42,frontend/views/__init__.py:123;LibraryUserincore/signals.py:33;core/tests.py:1205references theLibrarymodel.Proposed staged plan (each a reviewable PR, validated on test.unglue.it)
libraryauthinto a non-library home (e.g.core/auth.py/ keep a thin module), update thesettingspipeline/middleware paths and thefrontendimports. No feature change; the riskiest step for login, so validate social + password login on staging before merge.^libraryauth/…URLs, the library views, and templates; removeLibrary/library imports fromfrontendandcore(guard anyis_free/access-check call sites that consulted library access).Library,LibraryUser,Block,CardPattern,EmailPattern,BadUsernamePattern, IP fields; add the Django migration to drop the tables. (LibraryUseralso interacts withcore/signals.py— handle the signal.)'regluit.libraryauth'fromINSTALLED_APPS(or shrink the app to the relocated shared bits) and remove dead templates/tests.Risks / notes
lib_acqs,Hold/library holds) that assumeLibraryexists — audit those before step 2/3.handle_same_email_accountdedup signal inlibraryauth/signals.py(seelibraryauth_dedup_impact.md) — decide keep/relocate as part of step 1.Ask
Confirm the scope (remove feature B, preserve/relocate A) before the first PR lands, given step 1 rewires the core login path. PRs will be opened against
masterand validated on test.unglue.it.