mirror of
https://github.com/lldap/lldap.git
synced 2026-04-05 14:48:10 +00:00
app, server: Add an endpoint to fetch the frontend settings
This commit is contained in:
committed by
nitnelave
parent
ba93533790
commit
5afcdbda65
@@ -39,7 +39,6 @@ log = "*"
|
||||
orion = "0.17"
|
||||
rand_chacha = "0.3"
|
||||
rustls-pemfile = "1"
|
||||
serde = "*"
|
||||
serde_json = "1"
|
||||
sha2 = "0.10"
|
||||
thiserror = "*"
|
||||
@@ -97,6 +96,9 @@ path = "../crates/domain-model"
|
||||
[dependencies.lldap_domain_handlers]
|
||||
path = "../crates/domain-handlers"
|
||||
|
||||
[dependencies.lldap_frontend_options]
|
||||
path = "../crates/frontend-options"
|
||||
|
||||
[dependencies.lldap_validation]
|
||||
path = "../crates/validation"
|
||||
|
||||
@@ -111,6 +113,9 @@ version = "0.8"
|
||||
features = ["serde"]
|
||||
version = "*"
|
||||
|
||||
[dependencies.serde]
|
||||
workspace = true
|
||||
|
||||
[dependencies.strum]
|
||||
features = ["derive"]
|
||||
version = "0.25"
|
||||
|
||||
@@ -108,6 +108,12 @@ async fn wasm_handler_compressed<Backend>(
|
||||
)
|
||||
}
|
||||
|
||||
async fn get_settings<Backend>(data: web::Data<AppState<Backend>>) -> HttpResponse {
|
||||
HttpResponse::Ok().json(lldap_frontend_options::Options {
|
||||
password_reset_enabled: data.mail_options.enable_password_reset,
|
||||
})
|
||||
}
|
||||
|
||||
fn http_config<Backend>(
|
||||
cfg: &mut web::ServiceConfig,
|
||||
backend_handler: Backend,
|
||||
@@ -132,6 +138,7 @@ fn http_config<Backend>(
|
||||
"/health",
|
||||
web::get().to(|| async { HttpResponse::Ok().finish() }),
|
||||
)
|
||||
.route("/settings", web::get().to(get_settings::<Backend>))
|
||||
.service(
|
||||
web::scope("/auth")
|
||||
.configure(|cfg| auth_service::configure_server::<Backend>(cfg, enable_password_reset)),
|
||||
|
||||
Reference in New Issue
Block a user