We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Radicale password check fails (length limited?)
So far, the webdav radicale is protected with basic auth (apparently htaccess or similar).
If user password > 8 then it fails to connect. 
we should remove this limitation to let use stong passwords

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `core/admin/mailu/internal/views/auth.py`
Content:
```
1 from mailu import models, utils
2 from mailu.internal import internal, nginx
3 from flask import current_app as app
4 
5 import flask
6 import flask_login
7 import base64
8 import ipaddress
9 
10 
11 @internal.route("/auth/email")
12 def nginx_authentication():
13     """ Main authentication endpoint for Nginx email server
14     """
15     limiter = utils.limiter.get_limiter(app.config["AUTH_RATELIMIT"], "auth-ip")
16     client_ip = flask.request.headers["Client-Ip"]
17     if not limiter.test(client_ip):
18         response = flask.Response()
19         response.headers['Auth-Status'] = 'Authentication rate limit from one source exceeded'
20         response.headers['Auth-Error-Code'] = '451 4.3.2'
21         if int(flask.request.headers['Auth-Login-Attempt']) < 10:
22             response.headers['Auth-Wait'] = '3'
23         return response
24     headers = nginx.handle_authentication(flask.request.headers)
25     response = flask.Response()
26     for key, value in headers.items():
27         response.headers[key] = str(value)
28     if ("Auth-Status" not in headers) or (headers["Auth-Status"] != "OK"):
29         limit_subnet = str(app.config["AUTH_RATELIMIT_SUBNET"]) != 'False'
30         subnet = ipaddress.ip_network(app.config["SUBNET"])
31         if limit_subnet or ipaddress.ip_address(client_ip) not in subnet:
32             limiter.hit(flask.request.headers["Client-Ip"])
33     return response
34 
35 
36 @internal.route("/auth/admin")
37 def admin_authentication():
38     """ Fails if the user is not an authenticated admin.
39     """
40     if (not flask_login.current_user.is_anonymous
41         and flask_login.current_user.global_admin
42         and flask_login.current_user.enabled):
43         return ""
44     return flask.abort(403)
45 
46 
47 @internal.route("/auth/basic")
48 def basic_authentication():
49     """ Tries to authenticate using the Authorization header.
50     """
51     authorization = flask.request.headers.get("Authorization")
52     if authorization and authorization.startswith("Basic "):
53         encoded = authorization.replace("Basic ", "")
54         user_email, password = base64.b64decode(encoded).split(b":")
55         user = models.User.query.get(user_email.decode("utf8"))
56         if user and user.enabled and user.check_password(password.decode("utf8")):
57             response = flask.Response()
58             response.headers["X-User"] = user.email
59             return response
60     response = flask.Response(status=401)
61     response.headers["WWW-Authenticate"] = 'Basic realm="Login Required"'
62     return response
63
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/core/admin/mailu/internal/views/auth.py b/core/admin/mailu/internal/views/auth.py
--- a/core/admin/mailu/internal/views/auth.py
+++ b/core/admin/mailu/internal/views/auth.py
@@ -51,7 +51,7 @@
     authorization = flask.request.headers.get("Authorization")
     if authorization and authorization.startswith("Basic "):
         encoded = authorization.replace("Basic ", "")
-        user_email, password = base64.b64decode(encoded).split(b":")
+        user_email, password = base64.b64decode(encoded).split(b":", 1)
         user = models.User.query.get(user_email.decode("utf8"))
         if user and user.enabled and user.check_password(password.decode("utf8")):
             response = flask.Response()

{"golden_diff": "diff --git a/core/admin/mailu/internal/views/auth.py b/core/admin/mailu/internal/views/auth.py\n--- a/core/admin/mailu/internal/views/auth.py\n+++ b/core/admin/mailu/internal/views/auth.py\n@@ -51,7 +51,7 @@\n     authorization = flask.request.headers.get(\"Authorization\")\n     if authorization and authorization.startswith(\"Basic \"):\n         encoded = authorization.replace(\"Basic \", \"\")\n-        user_email, password = base64.b64decode(encoded).split(b\":\")\n+        user_email, password = base64.b64decode(encoded).split(b\":\", 1)\n         user = models.User.query.get(user_email.decode(\"utf8\"))\n         if user and user.enabled and user.check_password(password.decode(\"utf8\")):\n             response = flask.Response()\n", "issue": "Radicale password check fails (length limited?)\nSo far, the webdav radicale is protected with basic auth (apparently htaccess or similar).\r\nIf user password > 8 then it fails to connect. \r\nwe should remove this limitation to let use stong passwords\n", "before_files": [{"content": "from mailu import models, utils\nfrom mailu.internal import internal, nginx\nfrom flask import current_app as app\n\nimport flask\nimport flask_login\nimport base64\nimport ipaddress\n\n\n@internal.route(\"/auth/email\")\ndef nginx_authentication():\n    \"\"\" Main authentication endpoint for Nginx email server\n    \"\"\"\n    limiter = utils.limiter.get_limiter(app.config[\"AUTH_RATELIMIT\"], \"auth-ip\")\n    client_ip = flask.request.headers[\"Client-Ip\"]\n    if not limiter.test(client_ip):\n        response = flask.Response()\n        response.headers['Auth-Status'] = 'Authentication rate limit from one source exceeded'\n        response.headers['Auth-Error-Code'] = '451 4.3.2'\n        if int(flask.request.headers['Auth-Login-Attempt']) < 10:\n            response.headers['Auth-Wait'] = '3'\n        return response\n    headers = nginx.handle_authentication(flask.request.headers)\n    response = flask.Response()\n    for key, value in headers.items():\n        response.headers[key] = str(value)\n    if (\"Auth-Status\" not in headers) or (headers[\"Auth-Status\"] != \"OK\"):\n        limit_subnet = str(app.config[\"AUTH_RATELIMIT_SUBNET\"]) != 'False'\n        subnet = ipaddress.ip_network(app.config[\"SUBNET\"])\n        if limit_subnet or ipaddress.ip_address(client_ip) not in subnet:\n            limiter.hit(flask.request.headers[\"Client-Ip\"])\n    return response\n\n\n@internal.route(\"/auth/admin\")\ndef admin_authentication():\n    \"\"\" Fails if the user is not an authenticated admin.\n    \"\"\"\n    if (not flask_login.current_user.is_anonymous\n        and flask_login.current_user.global_admin\n        and flask_login.current_user.enabled):\n        return \"\"\n    return flask.abort(403)\n\n\n@internal.route(\"/auth/basic\")\ndef basic_authentication():\n    \"\"\" Tries to authenticate using the Authorization header.\n    \"\"\"\n    authorization = flask.request.headers.get(\"Authorization\")\n    if authorization and authorization.startswith(\"Basic \"):\n        encoded = authorization.replace(\"Basic \", \"\")\n        user_email, password = base64.b64decode(encoded).split(b\":\")\n        user = models.User.query.get(user_email.decode(\"utf8\"))\n        if user and user.enabled and user.check_password(password.decode(\"utf8\")):\n            response = flask.Response()\n            response.headers[\"X-User\"] = user.email\n            return response\n    response = flask.Response(status=401)\n    response.headers[\"WWW-Authenticate\"] = 'Basic realm=\"Login Required\"'\n    return response\n", "path": "core/admin/mailu/internal/views/auth.py"}], "after_files": [{"content": "from mailu import models, utils\nfrom mailu.internal import internal, nginx\nfrom flask import current_app as app\n\nimport flask\nimport flask_login\nimport base64\nimport ipaddress\n\n\n@internal.route(\"/auth/email\")\ndef nginx_authentication():\n    \"\"\" Main authentication endpoint for Nginx email server\n    \"\"\"\n    limiter = utils.limiter.get_limiter(app.config[\"AUTH_RATELIMIT\"], \"auth-ip\")\n    client_ip = flask.request.headers[\"Client-Ip\"]\n    if not limiter.test(client_ip):\n        response = flask.Response()\n        response.headers['Auth-Status'] = 'Authentication rate limit from one source exceeded'\n        response.headers['Auth-Error-Code'] = '451 4.3.2'\n        if int(flask.request.headers['Auth-Login-Attempt']) < 10:\n            response.headers['Auth-Wait'] = '3'\n        return response\n    headers = nginx.handle_authentication(flask.request.headers)\n    response = flask.Response()\n    for key, value in headers.items():\n        response.headers[key] = str(value)\n    if (\"Auth-Status\" not in headers) or (headers[\"Auth-Status\"] != \"OK\"):\n        limit_subnet = str(app.config[\"AUTH_RATELIMIT_SUBNET\"]) != 'False'\n        subnet = ipaddress.ip_network(app.config[\"SUBNET\"])\n        if limit_subnet or ipaddress.ip_address(client_ip) not in subnet:\n            limiter.hit(flask.request.headers[\"Client-Ip\"])\n    return response\n\n\n@internal.route(\"/auth/admin\")\ndef admin_authentication():\n    \"\"\" Fails if the user is not an authenticated admin.\n    \"\"\"\n    if (not flask_login.current_user.is_anonymous\n        and flask_login.current_user.global_admin\n        and flask_login.current_user.enabled):\n        return \"\"\n    return flask.abort(403)\n\n\n@internal.route(\"/auth/basic\")\ndef basic_authentication():\n    \"\"\" Tries to authenticate using the Authorization header.\n    \"\"\"\n    authorization = flask.request.headers.get(\"Authorization\")\n    if authorization and authorization.startswith(\"Basic \"):\n        encoded = authorization.replace(\"Basic \", \"\")\n        user_email, password = base64.b64decode(encoded).split(b\":\", 1)\n        user = models.User.query.get(user_email.decode(\"utf8\"))\n        if user and user.enabled and user.check_password(password.decode(\"utf8\")):\n            response = flask.Response()\n            response.headers[\"X-User\"] = user.email\n            return response\n    response = flask.Response(status=401)\n    response.headers[\"WWW-Authenticate\"] = 'Basic realm=\"Login Required\"'\n    return response\n", "path": "core/admin/mailu/internal/views/auth.py"}]}