diff --git a/app.py b/app.py index a03038e..aebc889 100644 --- a/app.py +++ b/app.py @@ -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/') diff --git a/static/css/style.css b/static/css/style.css index bf275f3..1fba13e 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -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); + } } \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 7707ff6..5f259ea 100644 --- a/templates/base.html +++ b/templates/base.html @@ -33,13 +33,15 @@ {% endif %}
- {% if current_user.is_authenticated and current_user.is_admin %} - ⚙️ Panel admina - {% endif %} - {% if current_user.is_authenticated %} - 🚪 Wyloguj - {% else %} - 🔑 Zaloguj + {% if request.endpoint != 'system_auth' %} + {% if current_user.is_authenticated and current_user.is_admin %} + ⚙️ Panel admina + {% endif %} + {% if current_user.is_authenticated %} + 🚪 Wyloguj + {% else %} + 🔑 Zaloguj + {% endif %} {% endif %}
diff --git a/templates/login.html b/templates/login.html index ebdb3c8..9f6bdf4 100644 --- a/templates/login.html +++ b/templates/login.html @@ -4,7 +4,6 @@

🔒 Logowanie

- ← Powrót do list
diff --git a/templates/main.html b/templates/main.html index 42814a8..8ff9762 100644 --- a/templates/main.html +++ b/templates/main.html @@ -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 diff --git a/templates/system_auth.html b/templates/system_auth.html index 827ae33..92d6b27 100644 --- a/templates/system_auth.html +++ b/templates/system_auth.html @@ -1,20 +1,28 @@ {% extends 'base.html' %} -{% block title %}Hasło do systemu{% endblock %} +{% block title %}Wymagane hasło główne{% endblock %} {% block content %}
-

🔑 Hasło do systemu

+

🔑 Podaj hasło główne

- +
-{% block scripts %}{% endblock %} + +{% block scripts %} + +{% endblock %} + {% endblock %}