| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- declare(strict_types=1);
- use App\App\Bootstrap;
- use App\Security\EntraAuth;
- require dirname(__DIR__) . '/src/autoload.php';
- Bootstrap::init();
- $app = Bootstrap::config('app');
- $auth = new EntraAuth();
- if (isset($_GET['logout']) && $_GET['logout'] === '1') {
- $auth->logout();
- header('Location: ' . Bootstrap::url('portal/login.php'));
- exit;
- }
- if ($auth->isLoggedIn()) {
- header('Location: ' . Bootstrap::url('portal/index.php'));
- exit;
- }
- $errorMessages = [
- 'access_denied' => 'Anmeldung nicht möglich: Ihr Konto ist für dieses Portal nicht freigeschaltet.',
- 'auth_failed' => 'Anmeldung fehlgeschlagen. Bitte erneut versuchen.',
- ];
- $error = $errorMessages[(string) ($_GET['error'] ?? '')] ?? '';
- $configured = $auth->isConfigured();
- $loginUrl = $configured ? $auth->getAuthorizationUrl() : '';
- ?><!doctype html>
- <html lang="de">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Jugendwart-Portal Login</title>
- <link rel="stylesheet" href="<?= htmlspecialchars(Bootstrap::url('assets/css/tokens.css')) ?>">
- <link rel="stylesheet" href="<?= htmlspecialchars(Bootstrap::url('assets/css/base.css')) ?>">
- </head>
- <body class="admin-page">
- <header class="site-header">
- <div class="container header-inner">
- <a class="brand" href="<?= htmlspecialchars(Bootstrap::url('portal/login.php')) ?>">
- <img class="brand-logo" src="<?= htmlspecialchars(Bootstrap::url('assets/images/feuerwehr-logo-invers.webp')) ?>" alt="Feuerwehr Logo">
- <div class="brand-title"><?= htmlspecialchars((string) ($app['project_name'] ?? 'Jugendwart-Portal')) ?></div>
- </a>
- </div>
- </header>
- <main class="container">
- <section class="card auth-container">
- <h1>Jugendwart-Portal</h1>
- <p>Anmeldung für Jugendbetreuer zur Bestätigung eingegangener unterschriebener Formulare.</p>
- <?php if ($error !== ''): ?>
- <p class="alert alert-error"><?= htmlspecialchars($error) ?></p>
- <?php endif; ?>
- <?php if ($configured): ?>
- <a class="btn" href="<?= htmlspecialchars($loginUrl) ?>">Mit Microsoft anmelden</a>
- <?php else: ?>
- <p class="alert alert-warning">Die Microsoft-Entra-Anmeldung ist noch nicht konfiguriert.</p>
- <?php endif; ?>
- </section>
- </main>
- </body>
- </html>
|