150 lines
4.2 KiB
HTML
150 lines
4.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>Login - sxbin</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
line-height: 1.6;
|
|
margin: 0;
|
|
padding: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: 100vh;
|
|
background-color: #1a1a1a;
|
|
color: #f0f0f0;
|
|
}
|
|
.content {
|
|
flex: 1;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
.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;
|
|
}
|
|
label {
|
|
margin-bottom: 5px;
|
|
}
|
|
input[type="text"],
|
|
input[type="password"] {
|
|
padding: 8px;
|
|
margin-bottom: 10px;
|
|
border-radius: 4px;
|
|
border: 1px solid #4CAF50;
|
|
background-color: #333;
|
|
color: #f0f0f0;
|
|
}
|
|
button {
|
|
background-color: #4CAF50;
|
|
color: white;
|
|
padding: 10px;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 16px;
|
|
}
|
|
button:hover {
|
|
background-color: #45a049;
|
|
}
|
|
.remember-me {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 10px;
|
|
}
|
|
.remember-me input {
|
|
margin-right: 5px;
|
|
}
|
|
p {
|
|
text-align: center;
|
|
margin-top: 15px;
|
|
}
|
|
a {
|
|
color: #4CAF50;
|
|
text-decoration: none;
|
|
}
|
|
a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
.back-button {
|
|
position: absolute;
|
|
top: 20px;
|
|
left: 20px;
|
|
font-size: 24px;
|
|
color: #4CAF50;
|
|
text-decoration: none;
|
|
}
|
|
.back-button:hover {
|
|
color: #45a049;
|
|
}
|
|
.footer {
|
|
text-align: center;
|
|
padding: 10px;
|
|
background-color: #2a2a2a;
|
|
color: #f0f0f0;
|
|
}
|
|
.error-message {
|
|
background-color: #ff6b6b;
|
|
color: white;
|
|
padding: 10px;
|
|
border-radius: 5px;
|
|
margin-bottom: 10px;
|
|
display: none;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<a href="/" class="back-button">←</a>
|
|
<div class="content">
|
|
<div class="container">
|
|
<h2>Login to sxbin</h2>
|
|
<div id="error-message" class="error-message"></div>
|
|
<form id="login-form" method="POST">
|
|
<label for="username">Username:</label>
|
|
<input type="text" id="username" name="username" required>
|
|
<label for="password">Password:</label>
|
|
<input type="password" id="password" name="password" required>
|
|
<label>
|
|
<input type="checkbox" name="remember"> Remember me
|
|
</label>
|
|
<input type="submit" value="Login">
|
|
</form>
|
|
<p>Don't have an account? <a href="{{ url_for('register') }}">Register</a></p>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById('login-form').addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
|
|
fetch('/login', {
|
|
method: 'POST',
|
|
body: new FormData(this),
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
window.location.href = data.redirect;
|
|
} else {
|
|
document.getElementById('error-message').textContent = data.error;
|
|
document.getElementById('error-message').style.display = 'block';
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |