Implement password change API endpoint
This commit is contained in:
@ -257,3 +257,18 @@ class AuditQueryFilter(AuditFilter):
|
||||
|
||||
offset: int = 0
|
||||
limit: int = 100
|
||||
|
||||
|
||||
class UserPasswordChange(BaseModel):
|
||||
"""Model for changing the password of a user."""
|
||||
|
||||
current_password: str
|
||||
new_password: str
|
||||
new_password_confirm: str
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_passwords(self) -> Self:
|
||||
"""Validate that the passwords match."""
|
||||
if self.new_password != self.new_password_confirm:
|
||||
raise ValueError("Passwords don't match")
|
||||
return self
|
||||
|
||||
Reference in New Issue
Block a user