1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-01-28 03:56:43 +02:00

Respect user enabled flag in basic authentication

This commit is contained in:
Stefan Auditor 2018-04-15 14:02:15 +02:00
parent 6fc22e5432
commit c8540ddba7

View File

@ -41,7 +41,7 @@ def basic_authentication():
encoded = authorization.replace("Basic ", "")
user_email, password = base64.b64decode(encoded).split(b":")
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.headers["X-User"] = user.email
return response