Test-Passwort abschaltbar: ohne ui.password_login weder in der Oberfläche noch über die API
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
08ddb92b71
commit
8b57f6c2ff
3 files changed
+9
-3
No files matched your search
@@ -535,6 +535,7 @@ async fn me(State(st): State<AppState>, Extension(actor): Extension<Actor>, Exte
|
||||
let mut me = serde_json::to_value(Service::new(&st.db, &actor).personal_dashboard()?).map_err(anyhow::Error::from)?;
|
||||
me["directory"] = json!(st.directory.is_some());
|
||||
me["enrolling"] = json!(st.db.session_enrolling(&token.0)?);
|
||||
me["password_login"] = json!(st.ui.password_login);
|
||||
ok(me)
|
||||
}
|
||||
|
||||
@@ -582,6 +583,9 @@ async fn set_password(
|
||||
Path(username): Path<String>,
|
||||
Json(input): Json<PasswordInput>,
|
||||
) -> ApiResult {
|
||||
if !st.ui.password_login {
|
||||
return Err(crate::service::forbidden("Die Anmeldung mit Passwort ist ausgeschaltet (ui.password_login)").into());
|
||||
}
|
||||
Service::new(&st.db, &actor).set_password(&username, &input.password)?;
|
||||
done()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user