97 lines
4.5 KiB
PHP
97 lines
4.5 KiB
PHP
<?php
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/intranet_repo/general_files/ini/parameters.php';
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/intranet_repo/general_files/ini/functions.php';
|
|
require_once __DIR__ . '/util/authorization_helpers.php';
|
|
|
|
authorization_start_session();
|
|
authorization_send_security_headers();
|
|
|
|
if (isset($_SESSION['user_id'])) {
|
|
authorization_redirect($g_httpHomePath, 302);
|
|
}
|
|
|
|
$isInvalid = false;
|
|
$email = '';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$email = trim((string) ($_POST['email'] ?? ''));
|
|
$loginPassword = (string) ($_POST['password'] ?? '');
|
|
|
|
if (!authorization_csrf_is_valid($_POST['csrf_token'] ?? null)) {
|
|
$isInvalid = true;
|
|
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL) || $loginPassword === '') {
|
|
$isInvalid = true;
|
|
} else {
|
|
$pdo = require $_SERVER['DOCUMENT_ROOT'] . '/intranet_repo/general_files/ini/database.php';
|
|
$userId = authorization_authenticate($pdo, $email, $loginPassword);
|
|
if ($userId !== null) {
|
|
session_regenerate_id(true);
|
|
$_SESSION = ['user_id' => $userId];
|
|
authorization_redirect($g_httpHomePath);
|
|
}
|
|
$isInvalid = true;
|
|
}
|
|
}
|
|
|
|
$csrfToken = authorization_csrf_token();
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="de" dir="ltr">
|
|
<head>
|
|
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/intranet_repo/projects/_central/php/html_head.php'; ?>
|
|
<link rel="stylesheet" href="/intranet_repo/projects/_central/layouts/authorization.css">
|
|
<script src="/intranet_repo/projects/_central/scripts/authorization.js" defer></script>
|
|
</head>
|
|
<body>
|
|
<div class="login_panel">
|
|
<?php if ($isInvalid): ?>
|
|
<div class="nak-toast nak-toast--error nak-toast--inline" data-auth-toast>
|
|
<div class="nak-toast__icon">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="square" stroke-linejoin="miter"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
|
|
</div>
|
|
<span class="nak-toast__text">Ungültige E-Mail-Adresse oder ungültiges Passwort.</span>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (($_GET['message'] ?? '') === '1'): ?>
|
|
<div class="nak-toast nak-toast--success nak-toast--inline" data-auth-toast>
|
|
<div class="nak-toast__icon">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="square" stroke-linejoin="miter"><path d="M20 6L9 17l-5-5"/></svg>
|
|
</div>
|
|
<span class="nak-toast__text">Passwort erfolgreich geändert. Sie können sich jetzt anmelden.</span>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="login_content">
|
|
<div class="nak-logo-link auth-logo">
|
|
<img class="auth-logo__icon" src="/intranet_repo/projects/_central/img/nak-logo.svg" alt="NAK Logo">
|
|
<div class="auth-logo__text">
|
|
<div class="auth-logo__name">Neuapostolische Kirche</div>
|
|
<div class="auth-logo__gemeinde">Berlin-Reinickendorf</div>
|
|
</div>
|
|
</div>
|
|
<h2>Anmelden</h2>
|
|
|
|
<form method="post" autocomplete="on">
|
|
<input type="hidden" name="csrf_token" value="<?= authorization_html($csrfToken) ?>">
|
|
<div class="flexcolumn_center">
|
|
<input class="login_field" placeholder="E-Mailadresse" type="email" name="email" id="email" value="<?= authorization_html($email) ?>" required autocomplete="username">
|
|
<input class="login_field" placeholder="Passwort" type="password" name="password" id="password" required autocomplete="current-password">
|
|
<input class="login_button" type="submit" value="Anmelden">
|
|
</div>
|
|
</form>
|
|
<div class="small_text" style="text-align:center;margin-top:24px;color:var(--gray-600);">
|
|
Sie haben noch keinen Account für das Intranet?<br>
|
|
<a href="signup.php">Registrieren</a><br><br>
|
|
Passwort vergessen?<br>
|
|
<a href="reset-password.php">Passwort zurücksetzen</a><br><br>
|
|
Probleme bei der Anmeldung?<br>
|
|
<a href="#" onclick="openContactModal(); return false;">Admin kontaktieren</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/intranet_repo/projects/_central/php/footer.php'; ?>
|
|
</body>
|
|
</html>
|