feat: Implement role-based registration restrictions and reorganize Bruno collection
- 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
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
meta {
|
||||
name: Update Password
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{base_url}}/api/auth/password
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"current_password": "password123",
|
||||
"new_password": "newpassword123",
|
||||
"confirm_password": "newpassword123"
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Update Password
|
||||
|
||||
Updates the authenticated user's password.
|
||||
|
||||
**Method:** PUT
|
||||
|
||||
**Endpoint:** /api/auth/password
|
||||
|
||||
**Authentication:** Required
|
||||
|
||||
**Request Body:**
|
||||
- `current_password` (string, required): Current password for verification
|
||||
- `new_password` (string, required): New password (minimum 6 characters)
|
||||
- `confirm_password` (string, required): Confirmation of new password
|
||||
|
||||
**Response:**
|
||||
- `message` (string): Success message
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 400: Password validation failed
|
||||
- 401: Current password incorrect
|
||||
- 401: Unauthorized
|
||||
}
|
||||
Reference in New Issue
Block a user