OpenNIT

Quelltext des aktuellen Standes

Fassung 1.1.1

login.php

6 KB
<?php $this->layout('layouts/auth', ['page_title' => 'Anmeldung']); ?>

<?php
$anyMethodEnabled = ($local_login_enabled ?? false)
    || ($azure_login_enabled ?? false)
    || ($keycloak_login_enabled ?? false)
    || ($ldap_auth_enabled ?? false);
?>

<div class="auth-box-body">
    <p class="auth-box-msg"><?= $this->te('Bitte melden Sie sich an, um fortzufahren.') ?></p>

    <?php if (!empty($error)): ?>
        <div class="auth-alert auth-alert-error">
            <?= $this->e($error) ?>
        </div>
    <?php endif; ?>

    <?php if ($local_login_enabled ?? false): ?>
        <form method="POST" action="/auth/login">
            <input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">

            <div class="auth-input-group">
                <input type="email" name="email" class="form-control" required
                       value="<?= $this->e($email ?? '') ?>"
                       placeholder="<?= $this->te('E-Mail-Adresse') ?>" autocomplete="email">
            </div>
            <div class="auth-input-group">
                <input type="password" name="password" class="form-control" required
                       placeholder="<?= $this->te('Passwort') ?>" autocomplete="current-password">
            </div>

            <button type="submit" class="btn btn-primary btn-block"><?= $this->te('Anmelden') ?></button>

            <?php if ($password_reset_enabled ?? false): ?>
            <p style="text-align:right;margin:0.5rem 0 0;font-size:0.82rem;">
                <a href="/password/forgot" style="color:var(--color-text-muted);text-decoration:underline;"><?= $this->te('Passwort vergessen?') ?></a>
            </p>
            <?php endif; ?>
        </form>
    <?php endif; ?>

    <?php if ($azure_login_enabled ?? false): ?>
        <?php if ($local_login_enabled ?? false): ?>
            <div class="auth-divider"><span><?= $this->te('oder') ?></span></div>
        <?php endif; ?>
        <a href="/auth/azure" class="btn btn-microsoft btn-block">
            <svg class="microsoft-logo" viewBox="0 0 21 21" width="20" height="20">
                <rect x="1" y="1" width="9" height="9" fill="#f25022"/>
                <rect x="11" y="1" width="9" height="9" fill="#00a4ef"/>
                <rect x="1" y="11" width="9" height="9" fill="#7fba00"/>
                <rect x="11" y="11" width="9" height="9" fill="#ffb900"/>
            </svg>
            <?= $this->te('Mit Microsoft 365 anmelden') ?>
        </a>
    <?php endif; ?>

    <?php if ($keycloak_login_enabled ?? false): ?>
        <?php if (($local_login_enabled ?? false) || ($azure_login_enabled ?? false)): ?>
            <div class="auth-divider"><span><?= $this->te('oder') ?></span></div>
        <?php endif; ?>
        <a href="/auth/keycloak" class="btn btn-block" style="background:var(--red-600);color:var(--color-on-accent);display:flex;align-items:center;justify-content:center;gap:0.5rem;">
            <svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor">
                <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"/>
            </svg>
            <?= $this->te('Mit Keycloak anmelden') ?>
        </a>
    <?php endif; ?>

    <?php if ($ldap_auth_enabled ?? false): ?>
        <?php if (($local_login_enabled ?? false) || ($azure_login_enabled ?? false) || ($keycloak_login_enabled ?? false)): ?>
            <div class="auth-divider"><span><?= $this->te('oder') ?></span></div>
        <?php endif; ?>

        <?php if (!empty($ldap_error)): ?>
            <div class="auth-alert auth-alert-error">
                <?= $this->e($ldap_error) ?>
            </div>
        <?php endif; ?>

        <details <?= !empty($ldap_error) || !empty($ldap_username) ? 'open' : '' ?> style="margin-top:0.5rem;">
            <summary style="cursor:pointer;font-size:0.875rem;color:var(--gray-500);text-align:center;padding:0.5rem;">
                <?= $this->te('Mit Active Directory anmelden') ?>
            </summary>
            <form method="POST" action="/auth/ldap" style="margin-top:0.75rem;">
                <input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
                <div class="auth-input-group">
                    <input type="text" name="ldap_username" class="form-control" required
                           value="<?= $this->e($ldap_username ?? '') ?>"
                           placeholder="<?= $this->te('Benutzername oder user@domain.de') ?>"
                           autocomplete="username">
                </div>
                <div class="auth-input-group">
                    <input type="password" name="ldap_password" class="form-control" required
                           placeholder="<?= $this->te('Passwort') ?>" autocomplete="current-password">
                </div>
                <button type="submit" class="btn btn-block" style="background:var(--gray-700);color:var(--color-on-accent);">
                    <?= $this->te('Mit Active Directory anmelden') ?>
                </button>
            </form>
        </details>
    <?php endif; ?>

    <?php if (!$anyMethodEnabled): ?>
        <div class="auth-alert auth-alert-error">
            <?= $this->te('Keine Anmeldemethode konfiguriert. Bitte kontaktieren Sie den Administrator.') ?>
        </div>
    <?php endif; ?>

    <?php if ($portal_magic_enabled ?? false): ?>
        <p style="text-align:center;margin:1rem 0 0;font-size:0.82rem;">
            <?= $this->t('<a href="/portal/magic" style="color:var(--color-text-muted);text-decoration:none;"> Ohne Konto? <span style="text-decoration:underline;">Anmelde-Link für das Self-Service-Portal anfordern</span> </a>') ?>
        </p>
    <?php endif; ?>
</div>