better data set for demo docker testing

This commit is contained in:
mr
2026-03-06 08:46:11 +01:00
parent 880e3564f1
commit af4893dd76
20 changed files with 298 additions and 52 deletions

View File

@@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Login</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f4f6f9;
display: flex;
height: 100vh;
align-items: center;
justify-content: center;
}
.login-container {
background: white;
padding: 40px;
border-radius: 8px;
box-shadow: 0 5px 20px rgba(0,0,0,0.1);
width: 300px;
}
h2 {
text-align: center;
}
input {
width: 100%;
padding: 10px;
margin-top: 10px;
border-radius: 4px;
border: 1px solid #ccc;
}
button {
width: 100%;
margin-top: 20px;
padding: 10px;
background: #007BFF;
border: none;
color: white;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background: #0056b3;
}
.error {
color: red;
margin-top: 10px;
text-align: center;
}
</style>
</head>
<body>
<div class="login-container">
<h2>Connexion</h2>
<form id="loginForm">
<input type="text" id="username" placeholder="Username" required />
<input type="password" id="password" placeholder="Password" required />
<button type="submit">Login</button>
<div class="error" id="error"></div>
</form>
</div>
<script>
function getLoginChallenge() {
const params = new URLSearchParams(window.location.search);
return params.get("login_challenge");
}
document.getElementById("loginForm").addEventListener("submit", async function(event) {
event.preventDefault();
const username = document.getElementById("username").value;
const password = document.getElementById("password").value;
const loginChallenge = getLoginChallenge();
if (!loginChallenge) {
document.getElementById("error").innerText = "Missing login_challenge in URL";
return;
}
try {
const response = await fetch("http://localhost:8000/auth/login", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
login_challenge: loginChallenge,
username: username,
password: password
})
});
if (!response.ok) {
throw new Error("Login failed");
}
const data = await response.json();
console.log("Success:", data);
alert("Login success");
} catch (err) {
document.getElementById("error").innerText = "Login failed";
}
});
</script>
</body>
</html>