Files
digiserver-v2/app/templates/auth/login.html
T
ske087 57b7810069 Fix 404 on the header logo caused by an encoded query string
base.html passed the cache-busting query string INSIDE the filename argument:

    url_for('static', filename='uploads/header_logo.png?v=1')

Flask percent-encodes the '?' to '%3F', producing a request for a file
literally named "header_logo.png%3Fv=1", which does not exist. Every
authenticated page therefore logged:

    GET /static/uploads/header_logo.png%3Fv=1 404

The logo silently stayed hidden too, because the element carries
onerror="this.style.display='none'".

Changes:
- base.html / login.html: append "?v=..." OUTSIDE url_for(), matching what
  admin/customize_logos.html already did correctly.
- Inject logo_version from a context processor instead of hardcoding it.
  It is derived from the newest logo's mtime, so uploading a new logo in
  Admin -> Customize Logos is reflected immediately. The previous value was
  a literal 1, which defeated cache-busting entirely; login.html used
  range(1, 999999) | random, which changed on every request and made the
  logo uncacheable.

Verified: /, /content/ and /players/ now render
/static/uploads/header_logo.png?v=<mtime> (HTTP 200), and no %3F requests
appear in the logs.
2026-09-11 13:18:29 +03:00

230 lines
6.5 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 - DigiServer</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
height: 100vh;
display: flex;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-container {
display: flex;
width: 100%;
height: 100vh;
}
.logo-section {
flex: 2;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(10px);
}
.logo-section img {
max-width: 70%;
max-height: 70%;
object-fit: contain;
filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}
.form-section {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
background: white;
padding: 2rem;
}
.login-form {
width: 100%;
max-width: 400px;
}
.login-form h2 {
color: #2d3748;
margin-bottom: 2rem;
font-size: 2rem;
text-align: center;
}
.form-group {
margin-bottom: 1.5rem;
}
.form-group label {
display: block;
margin-bottom: 0.5rem;
color: #4a5568;
font-weight: 500;
}
.form-group input[type="text"],
.form-group input[type="password"] {
width: 100%;
padding: 0.75rem;
border: 2px solid #e2e8f0;
border-radius: 8px;
font-size: 1rem;
transition: border-color 0.3s;
}
.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
outline: none;
border-color: #667eea;
}
.remember-me {
display: flex;
align-items: center;
margin-bottom: 1.5rem;
}
.remember-me input {
margin-right: 0.5rem;
}
.remember-me label {
color: #4a5568;
cursor: pointer;
}
.btn-login {
width: 100%;
padding: 0.75rem;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 8px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
}
.btn-login:hover {
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}
.register-link {
margin-top: 1.5rem;
text-align: center;
color: #718096;
}
.register-link a {
color: #667eea;
text-decoration: none;
font-weight: 600;
}
.register-link a:hover {
text-decoration: underline;
}
.flash-messages {
margin-bottom: 1.5rem;
}
.alert {
padding: 0.75rem;
border-radius: 8px;
margin-bottom: 0.5rem;
}
.alert-danger {
background: #fed7d7;
color: #c53030;
border: 1px solid #fc8181;
}
.alert-success {
background: #c6f6d5;
color: #2f855a;
border: 1px solid #68d391;
}
.alert-warning {
background: #feebc8;
color: #c05621;
border: 1px solid #f6ad55;
}
@media (max-width: 768px) {
.login-container {
flex-direction: column;
}
.logo-section {
flex: 1;
min-height: 200px;
}
.form-section {
flex: 2;
}
}
</style>
</head>
<body>
<div class="login-container">
<!-- Logo Section (Left - 2/3) -->
<div class="logo-section">
<img src="{{ url_for('static', filename='uploads/login_logo.png') }}?v={{ logo_version }}"
alt="DigiServer Logo"
onerror="this.style.display='none';">
</div>
<!-- Form Section (Right - 1/3) -->
<div class="form-section">
<div class="login-form">
<h2>Welcome Back</h2>
<!-- Flash Messages -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="flash-messages">
{% for category, message in messages %}
<div class="alert alert-{{ category }}">
{{ message }}
</div>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<form method="POST" action="{{ url_for('auth.login') }}">
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" required autofocus>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" required>
</div>
<div class="remember-me">
<input type="checkbox" id="remember" name="remember" value="yes">
<label for="remember">Remember me</label>
</div>
<button type="submit" class="btn-login">Login</button>
</form>
</div>
</div>
</div>
</body>
</html>