1
0
forked from cgcristi/aCloud
aCloudGaborV77/templates/password_prompt.html

109 lines
3.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Enter Password</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #1a1a1a;
color: #f0f0f0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
background-color: #2a2a2a;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
width: 300px;
}
h2 {
text-align: center;
color: #4CAF50;
}
form {
display: flex;
flex-direction: column;
}
input[type="password"] {
padding: 10px;
margin-bottom: 10px;
border: 1px solid #4CAF50;
border-radius: 4px;
background-color: #333;
color: #f0f0f0;
}
.button-container {
display: flex;
justify-content: space-between;
}
button {
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button[type="submit"] {
background-color: #4CAF50;
color: white;
}
button[type="button"] {
background-color: #888;
color: white;
}
.error {
color: #ff6b6b;
text-align: center;
margin-bottom: 10px;
}
.alert {
background-color: #ff6b6b;
color: white;
padding: 10px;
border-radius: 4px;
margin-bottom: 10px;
display: none;
}
</style>
</head>
<body>
<div class="container">
<h2>This content is password protected</h2>
<div id="errorAlert" class="alert">
Incorrect password. Please try again.
</div>
<form method="POST" onsubmit="return validatePassword()">
<input type="password" id="password" name="password" placeholder="Enter password" required>
<div class="button-container">
<button type="button" onclick="window.history.back()">Cancel</button>
<button type="submit">OK</button>
</div>
</form>
</div>
<script>
function validatePassword() {
var password = document.getElementById('password').value;
if (password.trim() === '') {
document.getElementById('errorAlert').style.display = 'block';
document.getElementById('errorAlert').textContent = 'Please enter a password.';
return false;
}
return true;
}
{% if error %}
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('errorAlert').style.display = 'block';
document.getElementById('errorAlert').textContent = '{{ error }}';
});
{% endif %}
</script>
</body>
</html>