prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <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
  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
  
  </issue>
  <code>
  [start of core/admin/mailu/internal/views/auth.py]
  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 @internal.route("/auth/user")
  47 def user_authentication():
  48     """ Fails if the user is not authenticated.
  49     """
  50     if (not flask_login.current_user.is_anonymous
  51         and flask_login.current_user.enabled):
  52         response = flask.Response()
  53         response.headers["X-User"] = flask_login.current_user.get_id()
  54         response.headers["X-User-Token"] = models.User.get_temp_token(flask_login.current_user.get_id())
  55         return response
  56     return flask.abort(403)
  57 
  58 
  59 @internal.route("/auth/basic")
  60 def basic_authentication():
  61     """ Tries to authenticate using the Authorization header.
  62     """
  63     authorization = flask.request.headers.get("Authorization")
  64     if authorization and authorization.startswith("Basic "):
  65         encoded = authorization.replace("Basic ", "")
  66         user_email, password = base64.b64decode(encoded).split(b":")
  67         user = models.User.query.get(user_email.decode("utf8"))
  68         if nginx.check_credentials(user, password.decode('utf-8'), flask.request.remote_addr, "web"):
  69             response = flask.Response()
  70             response.headers["X-User"] = user.email
  71             return response
  72     response = flask.Response(status=401)
  73     response.headers["WWW-Authenticate"] = 'Basic realm="Login Required"'
  74     return response
  75
  [end of core/admin/mailu/internal/views/auth.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: 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
  @@ -63,7 +63,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 nginx.check_credentials(user, password.decode('utf-8'), flask.request.remote_addr, "web"):
               response = flask.Response()
  
verification_info: {"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@@ -63,7 +63,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 nginx.check_credentials(user, password.decode('utf-8'), flask.request.remote_addr, \"web\"):\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\nRadicale 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@internal.route(\"/auth/user\")\ndef user_authentication():\n    \"\"\" Fails if the user is not authenticated.\n    \"\"\"\n    if (not flask_login.current_user.is_anonymous\n        and flask_login.current_user.enabled):\n        response = flask.Response()\n        response.headers[\"X-User\"] = flask_login.current_user.get_id()\n        response.headers[\"X-User-Token\"] = models.User.get_temp_token(flask_login.current_user.get_id())\n        return response\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 nginx.check_credentials(user, password.decode('utf-8'), flask.request.remote_addr, \"web\"):\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"}]}