Change flash messages with categories

This commit is contained in:
2023-06-08 00:49:15 +02:00
parent 57a137cc0f
commit 8e0d596a31

View File

@@ -46,7 +46,7 @@ def set_benchmark(benchmark_id):
if current_user.admin: if current_user.admin:
benchmark = Benchmark.query.filter_by(id=benchmark_id).first() benchmark = Benchmark.query.filter_by(id=benchmark_id).first()
if benchmark is None: if benchmark is None:
flash("Benchmark not found.") flash("Benchmark not found.", "danger")
return redirect(url_for(INDEX)) return redirect(url_for(INDEX))
current_user.benchmark = benchmark current_user.benchmark = benchmark
db.session.commit() db.session.commit()
@@ -71,7 +71,7 @@ def login():
if form.validate_on_submit(): if form.validate_on_submit():
user = User.query.filter_by(username=form.username.data).first() user = User.query.filter_by(username=form.username.data).first()
if user is None or not user.check_password(form.password.data): if user is None or not user.check_password(form.password.data):
flash("Invalid username or password") flash("Invalid username or password", "danger")
return redirect(url_for("main.login")) return redirect(url_for("main.login"))
login_user(user, remember=form.remember_me.data) login_user(user, remember=form.remember_me.data)
flash("Logged in successfully.") flash("Logged in successfully.")