Respect user enabled flag in basic authentication

master
Stefan Auditor 7 years ago
parent 6fc22e5432
commit c8540ddba7

@ -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