zmiany w css

This commit is contained in:
Mateusz Gruszczyński
2025-07-07 23:53:22 +02:00
parent 8152019632
commit f9b655defd
6 changed files with 48 additions and 15 deletions

8
app.py
View File

@@ -345,13 +345,17 @@ def main_page():
@app.route('/system-auth', methods=['GET', 'POST'])
def system_auth():
#ip = request.remote_addr
if current_user.is_authenticated or request.cookies.get('authorized') == AUTHORIZED_COOKIE_VALUE:
flash('Jesteś już zalogowany lub autoryzowany.', 'info')
return redirect(url_for('main_page'))
ip = request.access_route[0]
next_page = request.args.get('next') or url_for('main_page')
if is_ip_blocked(ip):
flash('Przekroczono limit prób logowania. Dostęp zablokowany na 1 godzinę.', 'danger')
return render_template('system_auth.html'), 403
if request.method == 'POST':
if request.form['password'] == SYSTEM_PASSWORD:
reset_failed_attempts(ip)
@@ -364,7 +368,7 @@ def system_auth():
flash('Przekroczono limit prób logowania. Dostęp zablokowany na 1 godzinę.', 'danger')
return render_template('system_auth.html'), 403
remaining = attempts_remaining(ip)
flash(f'Nieprawidłowe hasło do systemu. Pozostało prób: {remaining}', 'warning')
flash(f'Nieprawidłowe hasło. Pozostało {remaining} prób.', 'warning')
return render_template('system_auth.html')
@app.route('/toggle_archive_list/<int:list_id>')

View File

@@ -172,4 +172,24 @@ input.form-control {
.bg-dark .form-control::placeholder {
color: #ccc !important;
opacity: 1;
}
.toast-body {
color: #ffffff !important;
font-weight: 500 !important;
}
.toast {
animation: fadeInUp 0.5s ease;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

View File

@@ -33,13 +33,15 @@
{% endif %}
<div class="d-flex align-items-center gap-2">
{% if current_user.is_authenticated and current_user.is_admin %}
<a href="{{ url_for('admin_panel') }}" class="btn btn-outline-warning btn-sm">⚙️ Panel admina</a>
{% endif %}
{% if current_user.is_authenticated %}
<a href="{{ url_for('logout') }}" class="btn btn-outline-light btn-sm">🚪 Wyloguj</a>
{% else %}
<a href="{{ url_for('login') }}" class="btn btn-outline-light btn-sm">🔑 Zaloguj</a>
{% if request.endpoint != 'system_auth' %}
{% if current_user.is_authenticated and current_user.is_admin %}
<a href="{{ url_for('admin_panel') }}" class="btn btn-outline-warning btn-sm">⚙️ Panel admina</a>
{% endif %}
{% if current_user.is_authenticated %}
<a href="{{ url_for('logout') }}" class="btn btn-outline-light btn-sm">🚪 Wyloguj</a>
{% else %}
<a href="{{ url_for('login') }}" class="btn btn-outline-light btn-sm">🔑 Zaloguj</a>
{% endif %}
{% endif %}
</div>
</div>

View File

@@ -4,7 +4,6 @@
<div class="d-flex justify-content-between align-items-center flex-wrap mb-4">
<h2 class="mb-2">🔒 Logowanie</h2>
<a href="{{ url_for('main_page') }}" class="btn btn-outline-secondary">← Powrót do list</a>
</div>
<div class="card bg-dark text-white">

View File

@@ -25,7 +25,7 @@
data-active="0"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="Po włączeniu lista będzie ważna tylko 7 dni">
title="Po zaznaczeniu lista będzie ważna tylko 7 dni">
Tymczasowa
</button>
<input type="hidden" name="temporary" id="temporaryHidden" value="0">

View File

@@ -1,20 +1,28 @@
{% extends 'base.html' %}
{% block title %}Hasło do systemu{% endblock %}
{% block title %}Wymagane hasło główne{% endblock %}
{% block content %}
<div class="d-flex justify-content-between align-items-center flex-wrap mb-4">
<h2 class="mb-2">🔑 Hasło do systemu</h2>
<h2 class="mb-2">🔑 Podaj hasło główne</h2>
</div>
<div class="card bg-dark text-white">
<div class="card-body">
<form method="post">
<div class="mb-3">
<input type="password" name="password" placeholder="Hasło" class="form-control" required>
<input type="password" name="password" placeholder="Hasło" class="form-control rounded" required>
</div>
<button type="submit" class="btn btn-success w-100">🔓 Wejdź</button>
</form>
</div>
</div>
{% block scripts %}{% endblock %}
{% block scripts %}
<script>
document.addEventListener('DOMContentLoaded', function() {
document.querySelector('input[name="password"]').focus();
});
</script>
{% endblock %}
{% endblock %}