feat: Add ALLOW_REGISTRATION configuration to enable/disable user registration and introduce a Forbidden API error type.

This commit is contained in:
2025-12-25 23:05:26 +01:00
parent bb15181817
commit 0af7294468
7 changed files with 39 additions and 0 deletions

View File

@@ -23,6 +23,9 @@ pub enum ApiError {
#[error("Internal server error")]
Internal(String),
#[error("Forbidden: {0}")]
Forbidden(String),
}
/// Error response body
@@ -83,6 +86,14 @@ impl IntoResponse for ApiError {
},
)
}
ApiError::Forbidden(msg) => (
StatusCode::FORBIDDEN,
ErrorResponse {
error: "Forbidden".to_string(),
details: Some(msg.clone()),
},
),
};
(status, Json(error_response)).into_response()