OpenNIT

Quelltext des aktuellen Standes

Fassung 1.1.1

pin.php

6 KB
<?php $this->layout('layouts/main', ['page_title' => $page_title, 'current_route' => $current_route, 'full_width' => true]); ?>
<style>
.vp-wrap { max-width:520px; margin:1.75rem auto; padding:0 1rem; }
.vp-card { background:var(--color-bg); border:1px solid var(--gray-200); border-radius:0.75rem; padding:1.5rem 1.5rem; box-shadow:0 1px 3px rgba(0,0,0,.07); }
.vp-status { display:flex; align-items:center; gap:.5rem; font-size:.85rem; margin-bottom:1.25rem; padding:.6rem .9rem; border-radius:.5rem; }
.vp-on  { background:var(--emerald-50); color:var(--emerald-800); border:1px solid var(--emerald-200); }
.vp-off { background:var(--gray-50); color:var(--gray-500); border:1px solid var(--gray-200); }
.vp-label { display:block; font-size:.8rem; font-weight:600; color:var(--gray-700); margin:.75rem 0 .3rem; }
.vp-input { width:100%; padding:.6rem .8rem; border:1.5px solid var(--gray-200); border-radius:.5rem; font-size:.95rem; outline:none; }
.vp-input:focus { border-color:var(--blue-600); box-shadow:0 0 0 3px rgba(37,99,235,.15); }
.vp-btn { margin-top:1rem; padding:.6rem 1.2rem; background:var(--blue-600); color:var(--color-on-accent); border:none; border-radius:.5rem; font-size:.9rem; font-weight:600; cursor:pointer; }
.vp-btn:hover { background:var(--blue-700); }
.vp-btn-danger { background:var(--color-bg); color:var(--red-600); border:1px solid var(--red-300); }
.vp-btn-danger:hover { background:var(--red-100); }
.vp-hint { font-size:.8rem; color:var(--gray-500); line-height:1.55; margin-top:1rem; }
</style>

<div class="content-header">
    <div>
        <h1><?= $this->te('Tresor-PIN') ?></h1>
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="/"><?= $this->te('Home') ?></a></li>
            <li class="breadcrumb-item"><a href="/vault"><?= $this->te('Passwörter') ?></a></li>
            <li class="breadcrumb-item active"><?= $this->te('Tresor-PIN') ?></li>
        </ol>
    </div>
</div>

<div class="vp-wrap">
    <div class="vp-card">
        <?php if ($pin_enabled): ?>
        <div class="vp-status vp-on">
            <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M20 6 9 17l-5-5"/></svg>
            <?= $this->t('Tresor-PIN ist <strong>aktiv</strong>. Der Tresor wird pro Sitzung per PIN entsperrt.') ?>
        </div>
        <?php else: ?>
        <div class="vp-status vp-off">
            <?= $this->t('Tresor-PIN ist <strong>nicht aktiv</strong> – der Tresor wird automatisch beim Login entsperrt.') ?>
        </div>
        <?php endif; ?>

        <form method="POST" action="/vault/pin" autocomplete="off">
            <input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
            <label class="vp-label"><?= $this->te($pin_enabled ? 'Neuen PIN / Master-Passwort setzen' : 'PIN / Master-Passwort festlegen') ?> <?= $this->te('(min. 6 Zeichen)') ?></label>
            <input type="password" name="pin" class="vp-input" placeholder="••••••" required minlength="6">
            <label class="vp-label"><?= $this->te('Wiederholen') ?></label>
            <input type="password" name="pin_confirm" class="vp-input" placeholder="••••••" required minlength="6">
            <button type="submit" class="btn btn-primary btn-block"><?= $pin_enabled ? 'PIN ändern' : 'PIN aktivieren' ?></button>
        </form>

        <?php if ($pin_enabled): ?>
        <form method="POST" action="/vault/pin/disable" style="margin-top:.75rem;"
              data-confirm="Tresor-PIN wirklich deaktivieren? Der Tresor wird dann wieder automatisch beim Login entsperrt.">
            <input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
            <button type="submit" class="btn btn-danger btn-block"><?= $this->te('PIN deaktivieren') ?></button>
        </form>
        <?php endif; ?>

        <form method="POST" action="/vault/pin/lock-interval" style="margin-top:1.5rem; padding-top:1.25rem; border-top:1px solid var(--gray-200);">
            <input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
            <label class="vp-label" for="vp-idle-ttl" style="margin-top:0;"><?= $this->te('Automatische Sperre bei Inaktivität') ?></label>
            <select name="idle_ttl" id="vp-idle-ttl" class="vp-input">
                <?php
                $vpTtlOptions = [
                    300   => 'Nach 5 Minuten',
                    900   => 'Nach 15 Minuten (Standard)',
                    1800  => 'Nach 30 Minuten',
                    3600  => 'Nach 1 Stunde',
                    14400 => 'Nach 4 Stunden',
                    28800 => 'Nach 8 Stunden',
                    0     => 'Nie – nur beim Login sperren',
                ];
                $vpTtlCurrent = (int)($idle_ttl ?? 900);
                ?>
                <?php foreach ($vpTtlOptions as $vpVal => $vpLabel): ?>
                <option value="<?= $vpVal ?>" <?= $vpTtlCurrent === $vpVal ? 'selected' : '' ?>><?= $vpLabel ?></option>
                <?php endforeach; ?>
            </select>
            <p class="vp-hint" style="margin-top:.5rem;">
                <?= $pin_enabled
                    ? $this->te('Nach dieser Inaktivitätszeit wird der Tresor gesperrt und der PIN erneut abgefragt.')
                    : $this->te('Nach dieser Inaktivitätszeit wird der Tresor gesperrt und das Master-Passwort bzw. die SSO-Bestätigung erneut abgefragt.') ?>
            </p>
            <button type="submit" class="btn btn-primary btn-block"><?= $this->te('Sperr-Intervall speichern') ?></button>
        </form>

        <p class="vp-hint">
            <?= $this->te('Der PIN ist eine zusätzliche Schutzschicht: Der Tresor-Schlüssel wird beim Login nicht automatisch in die Sitzung geladen, sondern erst nach PIN-Eingabe. Nach mehreren Fehlversuchen wird die Eingabe vorübergehend gesperrt. Dein Login-Passwort bleibt davon unberührt.') ?>
        </p>
    </div>
</div>