ldap
All checks were successful
Deploy / deploy-staging (push) Successful in 35s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-06-15 01:14:51 +02:00
parent aff85ed12b
commit ecd7f70044

View File

@@ -16,6 +16,7 @@ $serviceResult = $ldap->testServiceBind();
$messages = [];
$errors = [];
$form = ['username' => '', 'password' => '', 'new_password' => ''];
$attempt = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$action = (string) ($_POST['action'] ?? '');
@@ -37,6 +38,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if ($errors === []) {
if ($action === 'test-login') {
$attempt = [
'action' => 'Login-Test',
'username' => $form['username'],
];
$result = $ldap->testUserCredentials($form['username'], $form['password']);
if ($result['success'] ?? false) {
@@ -45,6 +50,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$errors[] = (string) ($result['message'] ?? 'LDAP-Login fehlgeschlagen.');
}
} elseif ($action === 'change-password') {
$attempt = [
'action' => 'Passwortänderung',
'username' => $form['username'],
'new_password_length' => (string) strlen($form['new_password']),
];
$loginCheck = $ldap->testUserCredentials($form['username'], $form['password']);
if (!(bool) ($loginCheck['success'] ?? false)) {
@@ -121,7 +131,20 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
</div>
<?php endif; ?>
<form class="login-form" method="post" action="/admin/ldap-test">
<?php if (is_array($attempt)): ?>
<div class="login-notice login-notice-info">
<strong>Letzter Versuch</strong>
<ul class="login-list">
<li>Aktion: <?= htmlspecialchars((string) ($attempt['action'] ?? ''), ENT_QUOTES) ?></li>
<li>Benutzername: <?= htmlspecialchars((string) ($attempt['username'] ?? ''), ENT_QUOTES) ?></li>
<?php if (isset($attempt['new_password_length'])): ?>
<li>Länge neues Passwort: <?= htmlspecialchars((string) ($attempt['new_password_length'] ?? ''), ENT_QUOTES) ?></li>
<?php endif; ?>
</ul>
</div>
<?php endif; ?>
<form class="login-form" method="post" action="/admin/ldap-test/">
<label class="login-field">
<span>Benutzername</span>
<input type="text" name="username" value="<?= htmlspecialchars($form['username'], ENT_QUOTES) ?>" required>