Add a log in the UI when a login attempt is made

This commit is contained in:
Théophile Diot 2023-12-29 16:15:34 +00:00
parent d1d82aa300
commit 91448f1f45
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06

View file

@ -1660,6 +1660,7 @@ def jobs_download():
def login():
fail = False
if request.method == "POST" and "username" in request.form and "password" in request.form:
app.logger.warning(f"Login attempt from {request.remote_addr} with username \"{request.form['username']}\"")
if app.config["USER"].get_id() == request.form["username"] and app.config["USER"].check_password(request.form["password"]):
# log the user in
session["ip"] = request.remote_addr