don't run check_allowed until after block resolves

avoids computing an unused value if blocked_pass is going to halt authorization anyway

no change in behavior
This commit is contained in:
Min RK
2024-01-26 11:24:42 +01:00
parent 041acbc0bf
commit 000b42bdcf

View File

@@ -535,14 +535,13 @@ class Authenticator(LoggingConfigurable):
blocked_pass = await maybe_future(
self.check_blocked_users(username, authenticated)
)
allowed_pass = await maybe_future(self.check_allowed(username, authenticated))
if blocked_pass:
pass
else:
if not blocked_pass:
self.log.warning("User %r blocked. Stop authentication", username)
return
allowed_pass = await maybe_future(self.check_allowed(username, authenticated))
if allowed_pass:
if authenticated['admin'] is None:
authenticated['admin'] = await maybe_future(