1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-16 17:47:23 +01:00

Fixed SIM108 (if-else-block-instead-of-if-exp)

This commit is contained in:
Teal Dulcet
2023-12-22 07:17:23 -08:00
committed by Joshua Tauberer
parent 51dc7615f7
commit fba92de051
4 changed files with 6 additions and 24 deletions

View File

@@ -751,10 +751,7 @@ def log_failed_login(request):
# During setup we call the management interface directly to determine the user
# status. So we can't always use X-Forwarded-For because during setup that header
# will not be present.
if request.headers.getlist("X-Forwarded-For"):
ip = request.headers.getlist("X-Forwarded-For")[0]
else:
ip = request.remote_addr
ip = request.headers.getlist("X-Forwarded-For")[0] if request.headers.getlist("X-Forwarded-For") else request.remote_addr
# We need to add a timestamp to the log message, otherwise /dev/log will eat the "duplicate"
# message.