summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorMathijs van Veluw <[email protected]>2024-08-18 21:04:22 +0200
committerGitHub <[email protected]>2024-08-18 21:04:22 +0200
commit669b9db7583327f506a94da03c3cbb6838c0062e (patch)
treec9d09bc05de1d389d7324306932b0d6fb2db60d2 /src/api
parent3466a8040e33c8ac359fed99f3542ed5ed6603fa (diff)
downloadvaultwarden-669b9db7583327f506a94da03c3cbb6838c0062e.tar.gz
vaultwarden-669b9db7583327f506a94da03c3cbb6838c0062e.zip
Fix Vaultwarden Admin page error messages (#4869)
Since the change to camelCase variables the error messages in the Vaultwarden Admin were not shown correctly anymore. This PR fixes this by changing the case of the json key's. Also updated the save and delete of the config to provide a more descriptive error instead of only `Io` or which ever other error might occure. Fixes #4834
Diffstat (limited to 'src/api')
-rw-r--r--src/api/admin.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/api/admin.rs b/src/api/admin.rs
index 9a1d3417..e6be3783 100644
--- a/src/api/admin.rs
+++ b/src/api/admin.rs
@@ -750,12 +750,18 @@ fn get_diagnostics_config(_token: AdminToken) -> Json<Value> {
#[post("/config", data = "<data>")]
fn post_config(data: Json<ConfigBuilder>, _token: AdminToken) -> EmptyResult {
let data: ConfigBuilder = data.into_inner();
- CONFIG.update_config(data)
+ if let Err(e) = CONFIG.update_config(data) {
+ err!(format!("Unable to save config: {e:?}"))
+ }
+ Ok(())
}
#[post("/config/delete")]
fn delete_config(_token: AdminToken) -> EmptyResult {
- CONFIG.delete_user_config()
+ if let Err(e) = CONFIG.delete_user_config() {
+ err!(format!("Unable to delete config: {e:?}"))
+ }
+ Ok(())
}
#[post("/config/backup_db")]