tsk-61: Registration configuration #73
@@ -52,6 +52,7 @@ pub async fn register_user(
|
||||
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
||||
Json(payload): Json<request::Request>,
|
||||
) -> (StatusCode, Json<response::Response>) {
|
||||
if is_registration_enabled() {
|
||||
let mut user = icarus_models::user::User {
|
||||
username: payload.username.clone(),
|
||||
password: payload.password.clone(),
|
||||
@@ -115,4 +116,10 @@ pub async fn register_user(
|
||||
}),
|
||||
),
|
||||
}
|
||||
} else {
|
||||
(axum::http::StatusCode::NOT_ACCEPTABLE, Json(response::Response{
|
||||
message: String::from("Registration is not enabled"),
|
||||
data:: Vec::new()
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user