优化登陆成功信息提示
This commit is contained in:
parent
9fae531197
commit
40dce39e94
2
app.py
2
app.py
@ -305,7 +305,7 @@ def login():
|
|||||||
if check_password_hash(settings['admin_password_hash'], password):
|
if check_password_hash(settings['admin_password_hash'], password):
|
||||||
session['username'] = username
|
session['username'] = username
|
||||||
next_url = request.args.get('next', url_for('navigation')) # 默认跳转到首页
|
next_url = request.args.get('next', url_for('navigation')) # 默认跳转到首页
|
||||||
flash('登录成功', 'success')
|
# 移除flash消息,因为登录成功不需要显示
|
||||||
return redirect(next_url)
|
return redirect(next_url)
|
||||||
|
|
||||||
flash('用户名或密码错误', 'danger')
|
flash('用户名或密码错误', 'danger')
|
||||||
|
|||||||
@ -136,10 +136,12 @@
|
|||||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||||
{% if messages %}
|
{% if messages %}
|
||||||
{% for category, message in messages %}
|
{% for category, message in messages %}
|
||||||
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
|
{% if category != 'success' %} <!-- 不显示成功消息 -->
|
||||||
{{ message }}
|
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
{{ message }}
|
||||||
</div>
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user