OpenNIT

Quelltext des aktuellen Standes

Fassung 1.1.1

unlock.php

5 KB
<?php $this->layout('layouts/main', ['page_title' => $page_title, 'current_route' => $current_route, 'full_width' => true]); ?>
<style>
.vu-wrap { max-width:420px; margin:3rem auto; padding:0 1rem; }
.vu-card { background:var(--color-bg); border:1px solid var(--gray-200); border-radius:0.75rem; padding:2rem 1.75rem; text-align:center; box-shadow:0 1px 3px rgba(0,0,0,.07); }
.vu-icon { width:56px; height:56px; border-radius:50%; background:var(--color-primary-pale); color:var(--blue-600); display:flex; align-items:center; justify-content:center; margin:0 auto 1rem; }
.vu-title { font-size:1.15rem; font-weight:700; color:var(--gray-900); margin:0 0 .35rem; }
.vu-sub { font-size:.85rem; color:var(--gray-500); margin:0 0 1.5rem; }
.vu-input { width:100%; padding:.7rem .9rem; border:1.5px solid var(--gray-200); border-radius:.5rem; font-size:1.1rem; text-align:center; letter-spacing:.15em; outline:none; transition:border-color .15s, box-shadow .15s; }
.vu-input:focus { border-color:var(--blue-600); box-shadow:0 0 0 3px rgba(37,99,235,.15); }
.vu-card .btn-block { margin-top:1rem; padding:.6rem; }
.vu-foot { margin-top:1.25rem; font-size:.8rem; }
.vu-foot a { color:var(--gray-500); text-decoration:none; }
.vu-foot a:hover { color:var(--blue-600); }
.vu-locked { background:var(--red-50); border:1px solid var(--red-200); color:var(--red-700); border-radius:.5rem; padding:.6rem .9rem; font-size:.82rem; margin-bottom:1rem; }
</style>

<?php $mode = $mode ?? 'password'; ?>
<div class="vu-wrap">
    <div class="vu-card">
        <div class="vu-icon">
            <svg width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
        </div>
        <h1 class="vu-title"><?= $this->te('Tresor entsperren') ?></h1>
        <p class="vu-sub">
            <?php if ($mode === 'pin'): ?>
                <?= $this->te('Gib deinen Tresor-PIN ein, um den Tresor in dieser Sitzung wieder zu entsperren.') ?>
            <?php elseif ($mode === 'sso'): ?>
                <?= $this->te('Deine Sitzung ist aktiv – entsperre den Tresor mit einem Klick erneut.') ?>
            <?php else: ?>
                <?= $this->te('Gib dein Master-Passwort (dein Login-Passwort) ein, um den Tresor in dieser Sitzung wieder zu entsperren.') ?>
            <?php endif; ?>
        </p>

        <?php if (!empty($lock_remaining)): ?>
        <div class="vu-locked"><?= $this->t('Zu viele Fehlversuche. Bitte ca.') ?> <?= $this->te('{minuten} Minute(n) warten.', ['minuten' => (int)ceil($lock_remaining / 60)]) ?></div>
        <?php endif; ?>

        <form method="POST" action="/vault/unlock" autocomplete="off">
            <input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
            <?php if ($mode === 'pin'): ?>
                <input type="password" name="pin" class="vu-input" placeholder="••••••" autofocus
                       inputmode="numeric" <?= !empty($lock_remaining) ? 'disabled' : '' ?> required>
                <button type="submit" class="btn btn-primary btn-block" <?= !empty($lock_remaining) ? 'disabled' : '' ?>><?= $this->te('Entsperren') ?></button>
            <?php elseif ($mode === 'sso'): ?>
                <button type="submit" class="btn btn-primary btn-block" style="margin-top:0;"><?= $this->te('Tresor entsperren') ?></button>
                <?php if (!empty($has_password)): ?>
                <details style="margin-top:1rem; text-align:left;">
                    <summary style="font-size:.8rem; color:var(--gray-500); cursor:pointer;"><?= $this->te('Alternativ mit Master-Passwort entsperren') ?></summary>
                    <input type="password" name="password" class="vu-input" style="letter-spacing:normal; margin-top:.6rem;"
                           placeholder="<?= $this->te('Master-Passwort') ?>" autocomplete="current-password"
                           <?= !empty($lock_remaining) ? 'disabled' : '' ?>>
                </details>
                <?php endif; ?>
            <?php else: ?>
                <input type="password" name="password" class="vu-input" style="letter-spacing:normal;"
                       placeholder="<?= $this->te('Master-Passwort') ?>" autocomplete="current-password" autofocus
                       <?= !empty($lock_remaining) ? 'disabled' : '' ?> required>
                <button type="submit" class="btn btn-primary btn-block" <?= !empty($lock_remaining) ? 'disabled' : '' ?>><?= $this->te('Entsperren') ?></button>
            <?php endif; ?>
        </form>

        <div class="vu-foot"><a href="/dashboard"><?= $this->te('&#8592; Zurück zum Dashboard') ?></a></div>
    </div>
</div>