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

This commit is contained in:
Teal Dulcet
2024-03-10 07:54:51 -04:00
committed by Joshua Tauberer
parent 51dc7615f7
commit fba92de051
4 changed files with 6 additions and 24 deletions
+1 -4
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.