72 lines
3.0 KiB
PHP
72 lines
3.0 KiB
PHP
<?php
|
||
// login.php – Staging Login
|
||
$assetVersion = defined('ASSET_VERSION') ? ASSET_VERSION : time();
|
||
?><!doctype html>
|
||
<html lang="de">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>Login – EmailTemplate</title>
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
|
||
<!-- Admin-Theme (neu) -->
|
||
<link rel="stylesheet" href="/assets/css/app.css?v=<?= htmlspecialchars($assetVersion, ENT_QUOTES) ?>">
|
||
<link rel="stylesheet" href="/assets/css/admin.css?v=<?= htmlspecialchars($assetVersion, ENT_QUOTES) ?>">
|
||
|
||
<!-- Toast -->
|
||
<link rel="stylesheet" href="/assets/css/toast.css?v=<?= htmlspecialchars($assetVersion, ENT_QUOTES) ?>">
|
||
<script src="/assets/js/toast.js?v=<?= htmlspecialchars($assetVersion, ENT_QUOTES) ?>" defer></script>
|
||
|
||
<!-- Klein & lokal: Nur falls admin.css kein eigenes Login-Layout setzt -->
|
||
<style>
|
||
:root{--bg:#f6f7fb;--card:#fff;--bd:#e5e7eb;--txt:#0f172a}
|
||
body.login-fallback{background:var(--bg)}
|
||
.wrap{max-width:380px;margin:10vh auto;background:var(--card);border:1px solid var(--bd);
|
||
border-radius:16px;box-shadow:0 10px 30px rgba(2,6,23,.06);padding:28px}
|
||
h1{margin:0 0 8px;font-size:20px}
|
||
p{margin:0 0 18px;color:#475569}
|
||
label{display:block;margin:12px 0 6px;color:#334155}
|
||
input{width:100%;padding:12px;border:1px solid #cbd5e1;border-radius:10px;font-size:15px}
|
||
button{width:100%;margin-top:16px;padding:12px;border:0;border-radius:12px;background:#111827;color:#fff;font-weight:600;cursor:pointer}
|
||
.mini{margin-top:10px;text-align:center}
|
||
a{color:#111827}
|
||
</style>
|
||
|
||
<script>
|
||
async function already(){
|
||
try{
|
||
const r = await fetch('api.php?action=auth.me',{credentials:'include'});
|
||
const j = await r.json();
|
||
if(j && j.ok){ location.replace('index.php'); }
|
||
}catch(e){}
|
||
}
|
||
already();
|
||
|
||
async function doLogin(e){
|
||
e.preventDefault();
|
||
const email = document.getElementById('email').value.trim();
|
||
const password = document.getElementById('password').value;
|
||
const res = await fetch('api.php?action=auth.login', {
|
||
method:'POST', credentials:'include',
|
||
headers:{'Content-Type':'application/json'},
|
||
body: JSON.stringify({email, password})
|
||
});
|
||
const j = await res.json().catch(()=>({}));
|
||
if(j.ok){ location.replace('index.php'); }
|
||
else { window.showToast?.('Login fehlgeschlagen', {type:'error'}); }
|
||
}
|
||
</script>
|
||
</head>
|
||
<body class="page-login login-fallback">
|
||
<form class="wrap" onsubmit="doLogin(event)">
|
||
<h1>Willkommen zurück</h1>
|
||
<p>Melde dich an, um deine kundenspezifischen Templates zu verwalten.</p>
|
||
<label for="email">E-Mail</label>
|
||
<input id="email" type="email" required autocomplete="username" />
|
||
<label for="password">Passwort</label>
|
||
<input id="password" type="password" required autocomplete="current-password" />
|
||
<button type="submit">Anmelden</button>
|
||
<div class="mini"><a href="#" onclick="window.showToast?.('Passwort-Reset kommt später');return false;">Passwort vergessen?</a></div>
|
||
</form>
|
||
</body>
|
||
</html>
|