Skip to content

Fix CAS login errors caused by duplicate user accounts#390

Merged
C4ptainCrunch merged 3 commits into
mainfrom
fix/cas-duplicate-users
May 15, 2026
Merged

Fix CAS login errors caused by duplicate user accounts#390
C4ptainCrunch merged 3 commits into
mainfrom
fix/cas-duplicate-users

Conversation

@C4ptainCrunch

@C4ptainCrunch C4ptainCrunch commented May 15, 2026

Copy link
Copy Markdown
Contributor
  • Fix MultipleObjectsReturned on login (Sentry DOCHUB-219): replaced Q(netid) | Q(email) OR query with a two-step lookup (netid first, email fallback). CAS fields are synced on every login so the DB stays up to date when ULB changes emails/netids.
  • Clean up 64 ghost accounts: ULB's CAS sometimes returned national registry numbers as netids, creating duplicate accounts. Migration deletes them after safety checks (no documents lost, course follows transferred).
  • Log CAS failures to DB: new CasFailure model (read-only in admin) stores every auth error with code, details, ticket, and IP. Also logs EMAIL_CONFLICT when a CAS email update clashes with another account.
  • Drop leftover tables: removes actstream_* and authtoken_token tables from apps that are no longer installed.

C4ptainCrunch and others added 3 commits May 15, 2026 22:36
ULB changed email domains (ulb.ac.be → ulb.be) and netid formats
(human-readable → numeric national registry numbers), which caused
duplicate accounts and MultipleObjectsReturned errors on login.

- Replace Q(netid) | Q(email) lookup with netid-first, email-fallback
- Sync all CAS fields on every login (netid, email, name)
- Delete 64 users with bogus numeric netids (migration 0010)
- Drop leftover actstream/authtoken tables (migration 0009)
- Add CasFailure model to log all auth errors with context
- Log EMAIL_CONFLICT when CAS email clashes with another account

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
DROP TABLE ... CASCADE is not supported by SQLite, use plain
DROP TABLE IF EXISTS on SQLite.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@C4ptainCrunch C4ptainCrunch merged commit 09142a4 into main May 15, 2026
2 checks passed
@C4ptainCrunch C4ptainCrunch deleted the fix/cas-duplicate-users branch May 15, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant