bb-plane-fork/apps/api/plane/authentication/views/app
binarybeach c0cfbb2bdc binarybeachio: trusted view — mirror OAuth adapter create-shape (Profile, username, is_email_verified)
Plane's OAuth adapter (apps/api/plane/authentication/adapter/base.py:289-342)
creates User AND Profile when a new identity arrives. My trusted view was
calling User.objects.get_or_create() without the Profile, so the SPA's
/api/users/me/profile/ 404'd and the SPA bounced the user back to /login
in an onboarding loop.

Mirror the adapter's full create-shape: random username (uuid hex),
first/last names from JWT claims, is_password_autoset=True,
is_email_verified=True, random password (so Django's auth hash is non-empty
for break-glass), then Profile.objects.create(user=user). Wrapped in a
transaction so partial creation can't leave the DB inconsistent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 23:55:25 -10:00
..
check.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
email.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
gitea.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
github.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
gitlab.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
google.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
magic.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
password_management.py [GIT-44] refactor(auth): add PASSWORD_TOO_WEAK error code (#8522) 2026-02-13 18:51:33 +05:30
signout.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
trusted.py binarybeachio: trusted view — mirror OAuth adapter create-shape (Profile, username, is_email_verified) 2026-05-03 23:55:25 -10:00