Respect user enabled flag in basic authentication

master
Stefan Auditor 7 years ago
parent 92f4858323
commit d3064579f4

@ -41,7 +41,7 @@ def basic_authentication():
encoded = authorization.replace("Basic ", "") encoded = authorization.replace("Basic ", "")
user_email, password = base64.b64decode(encoded).split(b":") user_email, password = base64.b64decode(encoded).split(b":")
user = models.User.query.get(user_email.decode("utf8")) user = models.User.query.get(user_email.decode("utf8"))
if user and user.check_password(password.decode("utf8")): if user and user.enabled and user.check_password(password.decode("utf8")):
response = flask.Response() response = flask.Response()
response.headers["X-User"] = user.email response.headers["X-User"] = user.email
return response return response

Loading…
Cancel
Save