From 40dce39e94734cc4f5467df0897c76effc4787d8 Mon Sep 17 00:00:00 2001 From: wzj <244142824@qq.com> Date: Fri, 11 Jul 2025 16:15:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=99=BB=E9=99=86=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E4=BF=A1=E6=81=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 2 +- templates/login.html | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index 3694355..ea47242 100644 --- a/app.py +++ b/app.py @@ -305,7 +305,7 @@ def login(): if check_password_hash(settings['admin_password_hash'], password): session['username'] = username next_url = request.args.get('next', url_for('navigation')) # 默认跳转到首页 - flash('登录成功', 'success') + # 移除flash消息,因为登录成功不需要显示 return redirect(next_url) flash('用户名或密码错误', 'danger') diff --git a/templates/login.html b/templates/login.html index cf51656..24740a7 100644 --- a/templates/login.html +++ b/templates/login.html @@ -136,10 +136,12 @@ {% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} {% for category, message in messages %} - + {% if category != 'success' %} + + {% endif %} {% endfor %} {% endif %} {% endwith %}