Eigenes CSS statt Framework, Vanilla-JavaScript, heller und dunkler Modus. Ohne JavaScript bleibt alles bedienbar; das Liniendiagramm faellt auf eine selbst gezeichnete Balkendarstellung zurueck, wenn das CDN nicht erreichbar ist. Chart.js ist auf eine Version festgelegt und per Subresource Integrity an seinen Hash gebunden. Die Domain-Seite enthaelt eine Schritt-fuer-Schritt-Anleitung fuer DNS, Hosting-Panel und Zertifikat samt Fehlersuche.
86 lines
3.9 KiB
PHP
86 lines
3.9 KiB
PHP
<?php
|
||
|
||
/**
|
||
* @var App\Security\Csrf $csrf
|
||
* @var string $username
|
||
* @var array<string,string> $errors
|
||
* @var int $minLength
|
||
* @var string $tokenPath
|
||
*/
|
||
|
||
?>
|
||
<div class="card card--narrow">
|
||
<div class="card__head">
|
||
<span class="brand__mark brand__mark--lg" aria-hidden="true"></span>
|
||
<h1>Ersteinrichtung</h1>
|
||
<p class="muted">
|
||
Es ist noch kein Administrator-Konto vorhanden. Lege jetzt Benutzername und Passwort fest –
|
||
danach ist diese Seite gesperrt.
|
||
</p>
|
||
</div>
|
||
|
||
<form method="post" action="<?= $e($url('/setup')) ?>" class="form">
|
||
<?= $csrf->field() ?>
|
||
|
||
<div class="field <?= isset($errors['token']) ? 'field--error' : '' ?>">
|
||
<label for="setup_token">Einrichtungs-Token <span class="req">*</span></label>
|
||
<input type="text" id="setup_token" name="setup_token" required autofocus
|
||
spellcheck="false" autocapitalize="characters" autocomplete="off"
|
||
class="mono" placeholder="z. B. 3F9A1C0E7B2D4856">
|
||
<p class="field__hint">
|
||
Damit niemand anderes diese Installation übernimmt, steht das Token auf dem Server:
|
||
</p>
|
||
<details>
|
||
<summary>Wo finde ich das Token?</summary>
|
||
<ul class="checklist small muted">
|
||
<li><strong>Per FTP/SFTP oder Dateimanager:</strong> in der Datei
|
||
<code><?= $e($tokenPath) ?></code></li>
|
||
<li><strong>Docker:</strong> <code>docker compose logs app | grep Einrichtungs-Token</code>
|
||
oder <code>docker compose exec app cat data/setup-token.txt</code></li>
|
||
<li><strong>Mit Shell-Zugang:</strong> <code>cat <?= $e($tokenPath) ?></code></li>
|
||
</ul>
|
||
<p class="muted small">
|
||
Nach abgeschlossener Einrichtung wird die Datei automatisch gelöscht.
|
||
</p>
|
||
</details>
|
||
<?php if (isset($errors['token'])): ?>
|
||
<p class="field__error"><?= $e($errors['token']) ?></p>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<div class="field <?= isset($errors['username']) ? 'field--error' : '' ?>">
|
||
<label for="username">Benutzername</label>
|
||
<input type="text" id="username" name="username" value="<?= $e($username) ?>"
|
||
autocomplete="username" required>
|
||
<?php if (isset($errors['username'])): ?>
|
||
<p class="field__error"><?= $e($errors['username']) ?></p>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<div class="field <?= isset($errors['password']) ? 'field--error' : '' ?>">
|
||
<label for="password">Passwort</label>
|
||
<input type="password" id="password" name="password" autocomplete="new-password" required
|
||
minlength="<?= (int) $minLength ?>">
|
||
<p class="field__hint">Mindestens <?= (int) $minLength ?> Zeichen.</p>
|
||
<?php if (isset($errors['password'])): ?>
|
||
<p class="field__error"><?= $e($errors['password']) ?></p>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<div class="field <?= isset($errors['password_confirm']) ? 'field--error' : '' ?>">
|
||
<label for="password_confirm">Passwort wiederholen</label>
|
||
<input type="password" id="password_confirm" name="password_confirm" autocomplete="new-password" required>
|
||
<?php if (isset($errors['password_confirm'])): ?>
|
||
<p class="field__error"><?= $e($errors['password_confirm']) ?></p>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<button type="submit" class="btn btn--primary btn--block">Konto anlegen und anmelden</button>
|
||
</form>
|
||
|
||
<p class="muted small">
|
||
Alternativ kann das Konto auch fest in der <code>.env</code> hinterlegt werden
|
||
(<code>ADMIN_USER</code> und <code>ADMIN_PASSWORD_HASH</code>). Details stehen in der README.
|
||
</p>
|
||
</div>
|