Let the onboarding screen complete a profile (PMS-752) #507
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-752-complete-onboarding"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PMS-752. Small server half: one endpoint so the SPA's onboarding screen can finish. The SPA half is mokosh-apps #502 and needs this.
Since PMS-512,
profile_completed_athas had exactly one writer:upsert_user_from_oidc, stamping it on a login whose bunyip claims carry both names. A user whose claims did not carry them lands on mokosh's fallback onboarding screen and cannot leave it. That screen submits names toPUT /auth/me, which ignores them (bunyip owns the names, mokosh keeps a read-only cache), so nothing completes the profile and the AuthGuard sends the user straight back. It only looks healthy because bunyip normally supplies names and the screen is normally skipped.POST /api/v1/auth/me/complete-onboardingstamps it for the caller and returns the refreshed user. Idempotent viaCOALESCE, so a double submit or a replayed request records when onboarding was actually finished rather than moving the timestamp forward.Nothing about the request is trusted beyond the session: there is no body, the only assertion is "this user has been through onboarding", and the caller is the user.
Testing
cargo fmt --all --check,cargo clippy --all-targets, and a new test intests/bunyip_login.rsthat places a user with no name claims (so the profile is genuinely incomplete, asserted first), completes onboarding, and calls it twice to pin the idempotence. It sits with the two existing tests for the stamping rules it changes, rather than in a file of its own.