- Add role-based restrictions to POST /api/auth/register endpoint - Only admins can create admin accounts if any admin already exists - First user automatically gets admin role regardless of request - Regular users can only create user accounts, not admin accounts - Unauthenticated users can only create first admin, not subsequent admins - Reorganize Bruno collection into logical subfolders (auth/, admin/, profile/) - Update documentation to reflect new registration restrictions and security rules BREAKING CHANGES: - /api/auth/register now enforces role-based creation restrictions - Bruno collection reorganized with subfolder structure
46 lines
650 B
Plaintext
46 lines
650 B
Plaintext
meta {
|
|
name: Update Username
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
put {
|
|
url: {{base_url}}/api/auth/username
|
|
body: json
|
|
auth: inherit
|
|
}
|
|
|
|
body {
|
|
{
|
|
"username": "newusername"
|
|
}
|
|
}
|
|
|
|
settings {
|
|
encodeUrl: true
|
|
timeout: 0
|
|
}
|
|
|
|
docs {
|
|
## Update Username
|
|
|
|
Updates the authenticated user's username.
|
|
|
|
**Method:** PUT
|
|
|
|
**Endpoint:** /api/auth/username
|
|
|
|
**Authentication:** Required
|
|
|
|
**Request Body:**
|
|
- `username` (string, required): New username (3-50 characters)
|
|
|
|
**Response:**
|
|
- `message` (string): Success message
|
|
|
|
**Status Codes:**
|
|
- 200: Success
|
|
- 400: Invalid username
|
|
- 401: Unauthorized
|
|
- 409: Username already taken
|
|
} |