sd
This commit is contained in:
147
partials/landing/login/login.php
Normal file
147
partials/landing/login/login.php
Normal file
@@ -0,0 +1,147 @@
|
||||
<section id="auth" class="border-t border-brand-border/70 bg-brand-primarySoft/20">
|
||||
<div class="mx-auto max-w-4xl px-4 sm:px-6 lg:px-8 py-16 sm:py-20">
|
||||
<div class="mb-10 text-center space-y-3">
|
||||
<p class="text-xs font-heading font-semibold tracking-[0.3em] uppercase text-brand-primary" data-i18n="auth_kicker">
|
||||
Account & Login
|
||||
</p>
|
||||
<h1 class="font-heading text-2xl sm:text-3xl font-bold text-white" data-i18n="auth_title">
|
||||
Melde dich bei USBCheck an
|
||||
</h1>
|
||||
<p class="text-sm sm:text-base text-brand-muted max-w-2xl mx-auto" data-i18n="auth_intro">
|
||||
Mit einem Account kannst du Tests speichern, Reports exportieren und den Pro-Modus auf mehreren Geräten nutzen. Die Registrierung ist kostenlos – du kannst später jederzeit auf Pro upgraden.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-8 md:grid-cols-2 items-start">
|
||||
<!-- Login -->
|
||||
<div class="rounded-xl2 border border-brand-border bg-brand-surface/90 shadow-soft p-6 space-y-5">
|
||||
<h2 class="font-heading text-lg font-semibold text-white" data-i18n="auth_login_title">
|
||||
Login
|
||||
</h2>
|
||||
<p class="text-sm text-brand-muted" data-i18n="auth_login_text">
|
||||
Melde dich mit deiner E-Mail-Adresse und deinem Passwort an.
|
||||
</p>
|
||||
|
||||
<form method="post" action="/login/" class="space-y-4" autocomplete="on">
|
||||
<div class="space-y-1">
|
||||
<label for="login_email" class="block text-xs font-semibold tracking-wide uppercase text-brand-muted" data-i18n="auth_login_email_label">
|
||||
E-Mail-Adresse
|
||||
</label>
|
||||
<input
|
||||
type="email"
|
||||
id="login_email"
|
||||
name="email"
|
||||
required
|
||||
class="w-full rounded-lg border border-brand-border bg-brand-bg/60 px-3 py-2 text-sm text-brand-text placeholder:text-brand-muted/60 focus:outline-none focus:ring-2 focus:ring-brand-primary/60"
|
||||
placeholder="you@example.com"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="space-y-1">
|
||||
<label for="login_password" class="block text-xs font-semibold tracking-wide uppercase text-brand-muted" data-i18n="auth_login_password_label">
|
||||
Passwort
|
||||
</label>
|
||||
<input
|
||||
type="password"
|
||||
id="login_password"
|
||||
name="password"
|
||||
required
|
||||
class="w-full rounded-lg border border-brand-border bg-brand-bg/60 px-3 py-2 text-sm text-brand-text placeholder:text-brand-muted/60 focus:outline-none focus:ring-2 focus:ring-brand-primary/60"
|
||||
placeholder="••••••••"
|
||||
>
|
||||
</div>
|
||||
|
||||
<!-- Platzhalter für Fehlermeldungen (später per PHP / JS) -->
|
||||
<p class="text-xs text-red-400 hidden" id="login_error">
|
||||
<!-- Wird später dynamisch gefüllt -->
|
||||
</p>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="w-full inline-flex items-center justify-center rounded-full bg-brand-primary px-4 py-2.5 text-sm font-semibold text-brand-bg hover:bg-blue-400 transition-colors"
|
||||
data-i18n="auth_login_submit">
|
||||
Einloggen
|
||||
</button>
|
||||
|
||||
<div class="flex justify-between items-center text-xs text-brand-muted mt-1">
|
||||
<a href="#" class="hover:text-brand-primary transition-colors" data-i18n="auth_login_forgot">
|
||||
Passwort vergessen?
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Registrierung -->
|
||||
<div class="rounded-xl2 border border-brand-border bg-brand-surface/80 shadow-soft p-6 space-y-5">
|
||||
<h2 class="font-heading text-lg font-semibold text-white" data-i18n="auth_register_title">
|
||||
Kostenlos registrieren
|
||||
</h2>
|
||||
<p class="text-sm text-brand-muted" data-i18n="auth_register_text">
|
||||
Erstelle einen kostenlosen Account, um Tests zu speichern, Berichte zu exportieren und den Pro-Modus später freizuschalten.
|
||||
</p>
|
||||
|
||||
<form method="post" action="/login/" class="space-y-4" autocomplete="on">
|
||||
<input type="hidden" name="action" value="register">
|
||||
|
||||
<div class="space-y-1">
|
||||
<label for="reg_name" class="block text-xs font-semibold tracking-wide uppercase text-brand-muted" data-i18n="auth_register_name_label">
|
||||
Name
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="reg_name"
|
||||
name="name"
|
||||
required
|
||||
class="w-full rounded-lg border border-brand-border bg-brand-bg/60 px-3 py-2 text-sm text-brand-text placeholder:text-brand-muted/60 focus:outline-none focus:ring-2 focus:ring-brand-primary/60"
|
||||
placeholder="Dein Name"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="space-y-1">
|
||||
<label for="reg_email" class="block text-xs font-semibold tracking-wide uppercase text-brand-muted" data-i18n="auth_register_email_label">
|
||||
E-Mail-Adresse
|
||||
</label>
|
||||
<input
|
||||
type="email"
|
||||
id="reg_email"
|
||||
name="email"
|
||||
required
|
||||
class="w-full rounded-lg border border-brand-border bg-brand-bg/60 px-3 py-2 text-sm text-brand-text placeholder:text-brand-muted/60 focus:outline-none focus:ring-2 focus:ring-brand-primary/60"
|
||||
placeholder="you@example.com"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="space-y-1">
|
||||
<label for="reg_password" class="block text-xs font-semibold tracking-wide uppercase text-brand-muted" data-i18n="auth_register_password_label">
|
||||
Passwort
|
||||
</label>
|
||||
<input
|
||||
type="password"
|
||||
id="reg_password"
|
||||
name="password"
|
||||
required
|
||||
class="w-full rounded-lg border border-brand-border bg-brand-bg/60 px-3 py-2 text-sm text-brand-text placeholder:text-brand-muted/60 focus:outline-none focus:ring-2 focus:ring-brand-primary/60"
|
||||
placeholder="Mindestens 8 Zeichen"
|
||||
>
|
||||
</div>
|
||||
|
||||
<!-- Platzhalter für Fehlermeldungen (später per PHP / JS) -->
|
||||
<p class="text-xs text-red-400 hidden" id="register_error">
|
||||
<!-- Wird später dynamisch gefüllt -->
|
||||
</p>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="w-full inline-flex items-center justify-center rounded-full border border-brand-primary bg-brand-bg/80 px-4 py-2.5 text-sm font-semibold text-brand-primary hover:bg-brand-primary hover:text-brand-bg transition-colors"
|
||||
data-i18n="auth_register_submit">
|
||||
Account erstellen
|
||||
</button>
|
||||
|
||||
<p class="text-[11px] text-brand-muted/80 mt-1" data-i18n="auth_register_hint">
|
||||
Durch die Registrierung akzeptierst du die Datenschutzerklärung und das Impressum von USBCheck.
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
146
public/login.php
146
public/login.php
@@ -1,146 +0,0 @@
|
||||
<?php
|
||||
// public/login.php
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/../src/auth.php'; // lädt auch config/db.php
|
||||
|
||||
$lang = auth_get_lang();
|
||||
|
||||
$errors = [];
|
||||
$globalError = '';
|
||||
|
||||
// Optional: Redirect-Ziel (z. B. ?redirect=/account.php)
|
||||
$redirect = '/account.php';
|
||||
if (!empty($_GET['redirect']) && is_string($_GET['redirect'])) {
|
||||
// Nur interne Pfade erlauben, keine kompletten URLs
|
||||
if (strpos($_GET['redirect'], '/') === 0) {
|
||||
$redirect = $_GET['redirect'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// CSRF prüfen
|
||||
if (!auth_verify_csrf($_POST['csrf_token'] ?? null)) {
|
||||
$globalError = 'Sicherheitsfehler. Bitte die Seite neu laden und erneut versuchen.';
|
||||
} else {
|
||||
$identifier = trim((string)($_POST['identifier'] ?? ''));
|
||||
$password = (string)($_POST['password'] ?? '');
|
||||
|
||||
$result = auth_login($identifier, $password);
|
||||
|
||||
if ($result['success'] === true) {
|
||||
header('Location: ' . $redirect);
|
||||
exit;
|
||||
} else {
|
||||
$errors = $result['errors'] ?? [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$csrfToken = auth_csrf_token();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?php echo htmlspecialchars($lang, ENT_QUOTES, 'UTF-8'); ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Login – usbcheck.it</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- Fonts: Montserrat + Inter -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=Montserrat:wght@600;700&display=swap" rel="stylesheet">
|
||||
|
||||
<!-- Haupt-CSS -->
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=1">
|
||||
</head>
|
||||
<body>
|
||||
<?php include __DIR__ . '/partials/header.php'; ?>
|
||||
|
||||
<main>
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<div style="max-width: 480px; margin: 0 auto;">
|
||||
<h1 class="section-title" style="font-size: 1.6rem; text-align: center; margin-bottom: 1.5rem;">
|
||||
Anmelden bei usbcheck.it
|
||||
</h1>
|
||||
<p class="section-lead" style="text-align: center; margin-bottom: 2rem;">
|
||||
Melde dich mit deiner E-Mail-Adresse oder deinem Benutzernamen an, um deine USB-Tests und Geräte zu verwalten.
|
||||
</p>
|
||||
|
||||
<?php if ($globalError !== ''): ?>
|
||||
<div style="margin-bottom: 1rem; padding: 0.75rem 1rem; border-radius: 12px; background: #ffe6e8; color: #a4001f; font-size: 0.9rem;">
|
||||
<?php echo htmlspecialchars($globalError, ENT_QUOTES, 'UTF-8'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($errors['login'])): ?>
|
||||
<div style="margin-bottom: 1rem; padding: 0.75rem 1rem; border-radius: 12px; background: #ffe6e8; color: #a4001f; font-size: 0.9rem;">
|
||||
<?php echo htmlspecialchars($errors['login'], ENT_QUOTES, 'UTF-8'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" class="step-card">
|
||||
<div style="margin-bottom: 1rem;">
|
||||
<label for="identifier" style="display:block; font-size:0.9rem; margin-bottom:0.25rem;">
|
||||
E-Mail oder Benutzername
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="identifier"
|
||||
name="identifier"
|
||||
required
|
||||
style="
|
||||
width: 100%;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--silver);
|
||||
padding: 0.55rem 0.75rem;
|
||||
font-size: 0.95rem;
|
||||
font-family: 'Inter', system-ui, sans-serif;
|
||||
"
|
||||
value="<?php echo htmlspecialchars($_POST['identifier'] ?? '', ENT_QUOTES, 'UTF-8'); ?>"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 1rem;">
|
||||
<label for="password" style="display:block; font-size:0.9rem; margin-bottom:0.25rem;">
|
||||
Passwort
|
||||
</label>
|
||||
<input
|
||||
type="password"
|
||||
id="password"
|
||||
name="password"
|
||||
required
|
||||
style="
|
||||
width: 100%;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--silver);
|
||||
padding: 0.55rem 0.75rem;
|
||||
font-size: 0.95rem;
|
||||
font-family: 'Inter', system-ui, sans-serif;
|
||||
"
|
||||
>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($csrfToken, ENT_QUOTES, 'UTF-8'); ?>">
|
||||
|
||||
<div style="margin-top: 1.5rem; display:flex; flex-direction:column; gap:0.5rem;">
|
||||
<button type="submit" class="btn btn-primary" style="width: 100%; justify-content: center;">
|
||||
Login
|
||||
</button>
|
||||
|
||||
<a href="/register.php" class="btn btn-ghost" style="width: 100%; justify-content: center;">
|
||||
Noch kein Konto? Jetzt registrieren
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<?php include __DIR__ . '/partials/footer.php'; ?>
|
||||
|
||||
<script src="/assets/js/lang.js?v=1"></script>
|
||||
</body>
|
||||
</html>
|
||||
30
public/login/index.php
Normal file
30
public/login/index.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// Error-Output für Entwicklung
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require __DIR__ . '/../../src/functions.php';
|
||||
|
||||
// Sprachlogik:
|
||||
$lang = $_GET['lang'] ?? 'en';
|
||||
$lang = in_array($lang, ['de','en','it','fr']) ? $lang : 'en';
|
||||
|
||||
// (später: User-Dummy durch echte Session ersetzen)
|
||||
$userInitials = null;
|
||||
|
||||
// Seitentitel & Description für das Layout
|
||||
$pageTitle = 'Login – usbcheck.it';
|
||||
$pageDescription = 'Melde dich bei USBCheck an, um Tests zu speichern, Pro-Modus zu nutzen und mehrere Geräte zu verwalten.';
|
||||
|
||||
// Für die Login-Seite brauchen wir typischerweise keine Sektionen-Navigation
|
||||
$navAnchors = [];
|
||||
|
||||
// Layout-Start
|
||||
tpl('layout_start', 'structure');
|
||||
|
||||
// Login-/Register-Section
|
||||
tpl('login', 'landing', 'login');
|
||||
|
||||
// Layout-Ende
|
||||
tpl('layout_end', 'structure');
|
||||
Reference in New Issue
Block a user