testing
This commit is contained in:
82
public/login.php
Normal file
82
public/login.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/../config/db.php';
|
||||
require __DIR__ . '/../src/Auth.php';
|
||||
|
||||
$auth = new Auth($pdo);
|
||||
$error = '';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$identifier = trim($_POST['identifier'] ?? '');
|
||||
$password = $_POST['password'] ?? '';
|
||||
|
||||
if ($auth->login($identifier, $password)) {
|
||||
header('Location: /'); // nach Login auf Startseite
|
||||
exit;
|
||||
} else {
|
||||
$error = 'Login fehlgeschlagen. Bitte Zugangsdaten prüfen.';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Login – usbcheck.it</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- Dein Tailwind CSS -->
|
||||
<link rel="stylesheet" href="/css/tailwind.css">
|
||||
</head>
|
||||
<body class="bg-[#FAFAFA] text-[#1A1A1A] font-[Inter]">
|
||||
<div class="min-h-screen flex items-center justify-center px-4">
|
||||
<div class="w-full max-w-md bg-white shadow-lg rounded-2xl p-8">
|
||||
<h1 class="text-2xl font-[Montserrat] font-bold mb-6 text-center">
|
||||
Anmelden bei <span class="text-[#0051FF]">usbcheck.it</span>
|
||||
</h1>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="mb-4 text-sm text-[#E63946]">
|
||||
<?= htmlspecialchars($error, ENT_QUOTES, 'UTF-8') ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" class="space-y-4">
|
||||
<div>
|
||||
<label class="block text-sm mb-1" for="identifier">
|
||||
E-Mail oder Benutzername
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="identifier"
|
||||
name="identifier"
|
||||
required
|
||||
class="w-full border border-[#C8CBD0] rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-[#0051FF]"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm mb-1" for="password">
|
||||
Passwort
|
||||
</label>
|
||||
<input
|
||||
type="password"
|
||||
id="password"
|
||||
name="password"
|
||||
required
|
||||
class="w-full border border-[#C8CBD0] rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-[#0051FF]"
|
||||
>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="w-full bg-[#0051FF] text-white font-[Montserrat] font-semibold rounded-lg py-2 mt-4 hover:bg-blue-700 transition"
|
||||
>
|
||||
Login
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user