Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: only rate limit POST requests on auth routes, not GET

LearningCircuit81abf1426722
diff --git a/src/local_deep_research/web/auth/routes.py b/src/local_deep_research/web/auth/routes.py
index 107c304d4f..b47056f228 100644
--- a/src/local_deep_research/web/auth/routes.py
+++ b/src/local_deep_research/web/auth/routes.py
@@ -45,26 +45,32 @@ def get_csrf_token():
return jsonify({"csrf_token": token}), 200
-@auth_bp.route("/login", methods=["GET", "POST"])
+@auth_bp.route("/login", methods=["GET"])
+def login_page():
+ """
+ Login page (GET only).
+ Not rate limited - viewing the page should always work.
+ """
+ config = load_server_config()
+ # Check if already logged in
+ if session.get("username"):
+ return redirect(url_for("index"))
+
+ return render_template(
+ "auth/login.html",
+ has_encryption=db_manager.has_encryption,
+ allow_registrations=config.get("allow_registrations", True),
+ )
+
+
+@auth_bp.route("/login", methods=["POST"])
@login_limit
def login():
"""
- Login page and handler.
- Supports browser password managers with standard autocomplete attributes.
+ Login handler (POST only).
Rate limited to 5 attempts per 15 minutes per IP to prevent brute force attacks.
"""
config = load_server_config()
- if request.method == "GET":
- # Check if already logged in
- if session.get("username"):
- return redirect(url_for("index"))
-
- return render_template(
- "auth/login.html",
- has_encryption=db_manager.has_encryption,
- allow_registrations=config.get("allow_registrations", True),
- )
-
# POST - Handle login
username = request.form.get("username", "").strip()
password = request.form.get("password", "")
@@ -242,23 +248,34 @@ def login():
return redirect(safe_redirect)
-@auth_bp.route("/register", methods=["GET", "POST"])
+@auth_bp.route("/register", methods=["GET"])
+def register_page():
+ """
+ Registration page (GET only).
+ Not rate limited - viewing the page should always work.
+ """
+ config = load_server_config()
+ if not config.get("allow_registrations", True):
+ flash("New user registrations are currently disabled.", "error")
+ return redirect(url_for("auth.login_page"))
+
+ return render_template(
+ "auth/register.html", has_encryption=db_manager.has_encryption
+ )
+
+
+@auth_bp.route("/register", methods=["POST"])
@registration_limit
def register():
"""
- Registration page and handler.
+ Registration handler (POST only).
Creates new encrypted database for user with clear warnings about password recovery.
Rate limited to 3 attempts per hour per IP to prevent registration spam.
"""
config = load_server_config()
if not config.get("allow_registrations", True):
flash("New user registrations are currently disabled.", "error")
- return redirect(url_for("auth.login"))
-
- if request.method == "GET":
- return render_template(
- "auth/register.html", has_encryption=db_manager.has_encryption
- )
+ return redirect(url_for("auth.login_page"))
# POST - Handle registration
username = request.form.get("username", "").strip()