56 lines
1.9 KiB
HTML
56 lines
1.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>WAGO Simulator — Login</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="/static/style.css">
|
|
</head>
|
|
<body class="login-body">
|
|
<div class="login-card">
|
|
<div class="login-logo">
|
|
<svg width="72" height="72" viewBox="0 0 72 72" aria-hidden="true">
|
|
<rect x="8" y="14" width="56" height="44" rx="3" fill="#004a99" />
|
|
<rect x="8" y="14" width="56" height="10" fill="#003a7a" />
|
|
<text x="36" y="45" text-anchor="middle" font-size="11" fill="#fff"
|
|
font-family="Arial, sans-serif" font-weight="bold">750-362</text>
|
|
<circle cx="14" cy="19" r="2" fill="#4caf50"><animate attributeName="opacity"
|
|
values="1;0.2;1" dur="2s" repeatCount="indefinite"/></circle>
|
|
</svg>
|
|
</div>
|
|
<h1>WAGO Simulator</h1>
|
|
<p class="login-sub">FAT bench — Modbus TCP simulator</p>
|
|
<form id="login-form">
|
|
<label>User
|
|
<input id="user" name="user" autocomplete="username" required>
|
|
</label>
|
|
<label>Password
|
|
<input id="password" name="password" type="password"
|
|
autocomplete="current-password" required>
|
|
</label>
|
|
<button type="submit">Sign in</button>
|
|
<p id="login-error" class="error hidden"></p>
|
|
</form>
|
|
</div>
|
|
<script>
|
|
document.getElementById("login-form").addEventListener("submit", async (ev) => {
|
|
ev.preventDefault();
|
|
const err = document.getElementById("login-error");
|
|
err.classList.add("hidden");
|
|
const user = document.getElementById("user").value;
|
|
const password = document.getElementById("password").value;
|
|
const r = await fetch("/login", {
|
|
method: "POST",
|
|
headers: {"Content-Type": "application/json"},
|
|
body: JSON.stringify({user, password}),
|
|
});
|
|
if (r.ok) {
|
|
window.location.href = "/";
|
|
} else {
|
|
err.textContent = "Invalid credentials";
|
|
err.classList.remove("hidden");
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |