add login failure warning

This commit is contained in:
2024-06-22 04:49:45 +00:00
parent ae5fda3488
commit 2d407a53f0
2 changed files with 16 additions and 1 deletions

View File

@ -83,7 +83,7 @@ def login():
else:
error = 'An unknown error occurred.'
flash(error, 'error')
flash(error, 'danger')
return redirect(url_for('login'))
return render_template('login.html', form=form)

View File

@ -6,6 +6,21 @@
<div class="row justify-content-center">
<div class="col-md-6">
<h2 class="text-center">Login</h2>
<!-- Flash messages -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endfor %}
{% endif %}
{% endwith %}
<form id="loginForm" class="needs-validation" novalidate method="POST" action="/login">
{{ form.hidden_tag() }}
<div class="form-group">