feat(auth): password change (self + admin reset) with rate limiting; dedupe watchlist to user menu
Build & Push Docker Image / build (push) Successful in 2m19s

This commit is contained in:
opencode
2026-08-03 07:43:24 +02:00
parent 63f0bdbab6
commit 68a81ec775
20 changed files with 825 additions and 16 deletions
+127
View File
@@ -614,6 +614,58 @@ paths:
schema:
$ref: "#/components/schemas/ErrorResponse"
/auth/me/password:
post:
operationId: changeMyPassword
tags: [auth]
summary: Change own password (local users only)
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ChangePasswordInput"
responses:
"204":
description: Password changed
"400":
description: Invalid input or wrong current password
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"401":
description: Not authenticated
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"422":
description: OIDC user - password is managed by the identity provider
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"429":
description: Too many attempts
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/auth/password-redirect:
get:
operationId: getPasswordRedirect
tags: [auth]
summary: Get redirect URL for managing credentials in the identity provider
responses:
"200":
description: Redirect URL (null in local mode)
content:
application/json:
schema:
$ref: "#/components/schemas/PasswordRedirect"
/auth/me/preferences:
get:
operationId: getMePreferences
@@ -783,6 +835,51 @@ paths:
"204":
description: Deleted
/users/{id}/password:
patch:
operationId: setUserPassword
tags: [users]
summary: Set/reset a user's password (admin only, local users only)
parameters:
- name: id
in: path
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/SetPasswordInput"
responses:
"204":
description: Password updated
"400":
description: Validation error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"404":
description: User not found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"422":
description: OIDC user - password is managed by the identity provider
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"429":
description: Too many attempts
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/audit-logs:
get:
operationId: listAuditLogs
@@ -870,6 +967,10 @@ components:
tier:
type: string
enum: [free, premium, enterprise]
authProvider:
type: string
enum: [local, oidc]
default: local
createdAt:
type: string
format: date-time
@@ -903,6 +1004,32 @@ components:
type: string
enum: [free, premium, enterprise]
ChangePasswordInput:
type: object
required: [currentPassword, newPassword]
properties:
currentPassword:
type: string
minLength: 1
newPassword:
type: string
minLength: 8
SetPasswordInput:
type: object
required: [password]
properties:
password:
type: string
minLength: 8
PasswordRedirect:
type: object
required: [url]
properties:
url:
type: ["string", "null"]
AuditLog:
type: object
required: [id, entityType, action, userId, username, createdAt]