| Server IP : 193.86.120.172 / Your IP : 216.73.216.215 Web Server : Apache/2.4.63 (Unix) System : Linux JServices 3.10.108 #86003 SMP Wed Oct 22 13:20:46 CST 2025 x86_64 User : kubec ( 1026) PHP Version : 8.2.28 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /volume1/web/hotellesnizatisi_cz/new/ |
Upload File : |
<?php
require_once __DIR__ . '/includes/auth.php';
$user = require_login();
$error = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$nove = $_POST['nove_heslo'] ?? '';
$znovu = $_POST['nove_heslo_znovu'] ?? '';
if (strlen($nove) < 8) {
$error = 'Heslo musí mít alespoň 8 znaků.';
} elseif ($nove !== $znovu) {
$error = 'Hesla se neshodují.';
} else {
$hash = password_hash($nove, PASSWORD_DEFAULT);
db()->prepare('UPDATE uzivatele SET heslo_hash = ?, vyzaduje_zmenu_hesla = 0 WHERE id = ?')
->execute([$hash, $user['id']]);
header('Location: ' . home_url_for_user($user));
exit;
}
}
?>
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Změna hesla — Administrace Lesní zátiší</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500&display=swap" rel="stylesheet">
<style>
:root{
--bg:#F4F2EC; --surface:#FFFFFF; --border:#E4E0D2;
--ink:#232A1F; --ink-soft:#6B7263;
--accent:#C2884F; --accent-dark:#9C6E3F;
--red:#B4543C; --red-soft:#F5E4DF;
}
*{margin:0;padding:0;box-sizing:border-box;}
body{
font-family:"Work Sans",sans-serif; background:var(--bg); color:var(--ink);
min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px;
}
.card{
background:var(--surface); border:1px solid var(--border); border-radius:10px;
width:100%; max-width:380px; padding:36px 32px; box-shadow:0 10px 40px rgba(35,42,31,.08);
}
.card h1{font-size:1.2rem; font-weight:700; margin-bottom:4px;}
.card .sub{
font-family:"IBM Plex Mono",monospace; font-size:.7rem; letter-spacing:.1em; text-transform:uppercase;
color:var(--accent-dark); margin-bottom:20px;
}
.hint{font-size:.83rem; color:var(--ink-soft); margin-bottom:20px; line-height:1.5;}
.field{margin-bottom:16px;}
.field label{display:block; font-size:.8rem; font-weight:600; color:var(--ink-soft); margin-bottom:6px;}
.field input{
width:100%; padding:11px 13px; border:1px solid var(--border); border-radius:6px;
background:var(--bg); font-family:inherit; font-size:.92rem; color:var(--ink);
}
.field input:focus{outline:2px solid var(--accent); outline-offset:1px;}
.btn{
width:100%; padding:12px; margin-top:6px; border:none; border-radius:6px;
background:var(--ink); color:#fff; font-weight:600; font-size:.92rem; cursor:pointer;
}
.btn:hover{background:#1a201a;}
.error{
background:var(--red-soft); color:var(--red); border-radius:6px; padding:10px 13px;
font-size:.82rem; margin-bottom:18px;
}
</style>
</head>
<body>
<div class="card">
<h1>Lesní zátiší</h1>
<div class="sub">Změna hesla</div>
<?php if ((int)$user['vyzaduje_zmenu_hesla'] === 1): ?>
<p class="hint">Než budete moci pokračovat, nastavte si prosím vlastní heslo.</p>
<?php endif; ?>
<?php if ($error): ?>
<div class="error"><?= htmlspecialchars($error) ?></div>
<?php endif; ?>
<form method="post" novalidate>
<div class="field">
<label for="nove_heslo">Nové heslo</label>
<input type="password" id="nove_heslo" name="nove_heslo" required autofocus minlength="8">
</div>
<div class="field">
<label for="nove_heslo_znovu">Nové heslo znovu</label>
<input type="password" id="nove_heslo_znovu" name="nove_heslo_znovu" required minlength="8">
</div>
<button type="submit" class="btn">Uložit nové heslo</button>
</form>
</div>
</body>
</html>