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()
|
||||
}
|
||||
|
||||
+3
-3
@@ -1025,8 +1025,8 @@ async function accountPage() {
|
||||
h('tr', {}, h('td', { class: 'muted' }, 'Rolle'), h('td', {}, ROLE[u.role])),
|
||||
h('tr', {}, h('td', { class: 'muted' }, 'E-Mail'), h('td', {}, u.email || '–')),
|
||||
h('tr', {}, h('td', { class: 'muted' }, 'Gruppen'), h('td', { class: 'wrap' }, state.me.groups.join(', ') || '–'))))),
|
||||
h('section', { class: 'card grow' }, h('h2', {}, 'Passwort (Testbetrieb)'),
|
||||
h('p', { class: 'hint' }, 'Nur für die Anmeldung mit Passwort im Testbetrieb. Das Passwort der Hochschule änderst du dort.'), pw)),
|
||||
state.me.password_login ? h('section', { class: 'card grow' }, h('h2', {}, 'Passwort (Testbetrieb)'),
|
||||
h('p', { class: 'hint' }, 'Nur für die Anmeldung mit Passwort im Testbetrieb. Das Passwort der Hochschule änderst du dort.'), pw) : null),
|
||||
signInCards(methods),
|
||||
recoveryCard(methods),
|
||||
h('section', { class: 'card' }, h('h2', {}, 'Meine Daten (DSGVO-Auskunft)'),
|
||||
@@ -1907,7 +1907,7 @@ async function usersPage() {
|
||||
h('div', { class: 'field-group' }, h('label', { for: 'u-mail' }, 'E-Mail'), userMail),
|
||||
h('div', { class: 'field-group' }, h('label', { for: 'u-role' }, 'Rolle'),
|
||||
h('select', { id: 'u-role', name: 'role', class: 'field' }, Object.entries(ROLE).map(([v, l]) => h('option', { value: v }, l)))),
|
||||
h('div', { class: 'field-group' }, h('label', { for: 'u-pw' }, 'Passwort (Testbetrieb)'), h('input', { id: 'u-pw', name: 'password', type: 'password', class: 'field', autocomplete: 'new-password' }))),
|
||||
state.me.password_login ? h('div', { class: 'field-group' }, h('label', { for: 'u-pw' }, 'Passwort (Testbetrieb)'), h('input', { id: 'u-pw', name: 'password', type: 'password', class: 'field', autocomplete: 'new-password' })) : null),
|
||||
h('span', { class: 'hint' }, state.me.directory ? 'Personen registrieren sich selbst bei der ersten Anmeldung mit dem Login der Hochschule. Hier angelegte Konten müssen im Verzeichnis stehen; die E-Mail-Adresse kommt von dort.'
|
||||
: 'Im Betrieb registrieren sich Personen selbst mit dem Login der Hochschule (LDAP).'),
|
||||
h('div', { class: 'actions' }, h('button', { class: 'btn primary', type: 'submit' }, 'Benutzer anlegen')));
|
||||
|
||||
@@ -3,6 +3,8 @@ database = "run/test.db"
|
||||
first_admin = "admin"
|
||||
|
||||
[ui]
|
||||
# Anmeldung mit Passwort aus der Datenbank, nur für Tests; die Testskripte brauchen sie.
|
||||
# Mit false verschwindet sie aus der Oberfläche und die API nimmt sie nicht mehr an.
|
||||
password_login = true
|
||||
|
||||
# Verzeichnis der Hochschule: Anmeldung mit dem Login der Hochschule und Personensuche
|
||||
|
||||
Reference in new issue
Block a user