Project

General

Profile

Sub-Task #120

Updated by Bricklou 22 days ago

Technical specification of the username change endpoint. The email change has its own specification in #308. 

 Endpoint (`PUT /api/v1/me/profile`): 

 * The body carries the new username. The endpoint changes the username of the account behind the session and nothing else. 
 * The response is the current user (`data`), with `managed_by_provider` and the pending email change, if any. 
 * 401 without a session. 403 when the account signs in through a login provider. 409 when the username is taken. 422 when it breaks the username rules. All errors are Problem Details and documented in the OpenAPI schema. 
 * The change is written to the change log and announced as a profile change. 

 Acceptance criteria: 

 * [x] The username changes and the response returns the updated user. 
 * [x] A taken username, an invalid username, a missing session and a provider-managed account are each refused with the right status. 
 * [x] Every case is covered by a test, with a real database.

Back