aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/views/session.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-15 20:42:20 +0100
committerDennis Fink2026-11-15 20:42:20 +0100
commit509d93b2976e353d29441a7a7b7e78ca466dc4fd (patch)
tree753e637aefabd4293f808addbf9c310eaf0aa552 /webmentions_ssg/views/session.py
parentc74feda222745ab7cca8993df83d9ea5f9d07e5b (diff)
downloadwebmentions-ssg-509d93b2976e353d29441a7a7b7e78ca466dc4fd.tar.gz
webmentions-ssg-509d93b2976e353d29441a7a7b7e78ca466dc4fd.zip
refactor(core)!: standardize application terminology
Rename configuration keys, task helpers, forms, network utilities, and view endpoints to make their responsibilities and domains more explicit. Align source-management routes and templates with the new terminology and rename the target-matching module and related task abstractions consistently. BREAKING CHANGE: configuration keys have been renamed and sent-source routes move from `/sent` to `/sources`, with corresponding blueprint endpoint changes.
Diffstat (limited to '')
-rw-r--r--webmentions_ssg/views/session.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/webmentions_ssg/views/session.py b/webmentions_ssg/views/session.py
index 371997d..d9cec7f 100644
--- a/webmentions_ssg/views/session.py
+++ b/webmentions_ssg/views/session.py
@@ -11,25 +11,25 @@ from flask_login import current_user, login_required, login_user, logout_user
from werkzeug.security import check_password_hash
from .. import forms
-from ..auth import dummy_password_hash, is_safe_next_url, login_username_limit_key
+from ..auth import dummy_password_hash, is_safe_next_url, login_username_rate_limit_key
from ..extensions import db, limiter
from ..models import User
-from .blueprint import root_page
+from .blueprint import webmentions_bp
-@root_page.route("/")
+@webmentions_bp.route("/")
def index() -> ResponseReturnValue:
"""Redirect to the received Webmentions view.
:returns: Redirect response to the received Webmentions view.
"""
- return redirect(url_for("root.received"))
+ return redirect(url_for("webmentions.received_list"))
-@root_page.route("/login", methods=["GET", "POST"])
+@webmentions_bp.route("/login", methods=["GET", "POST"])
@limiter.limit(
lambda: current_app.config["LOGIN_USERNAME_RATE_LIMIT"],
- key_func=login_username_limit_key,
+ key_func=login_username_rate_limit_key,
methods=["POST"],
error_message="Too many login attempts. Please try again later.",
)
@@ -48,7 +48,7 @@ def login() -> ResponseReturnValue:
:returns: Rendered login page or redirect response.
"""
if current_user.is_authenticated:
- return redirect(url_for("root.index"))
+ return redirect(url_for("webmentions.index"))
form = forms.LoginForm()
@@ -61,18 +61,18 @@ def login() -> ResponseReturnValue:
password_ok = check_password_hash(password_hash, form.password.data or "")
if user is None or not password_ok:
flash("Invalid username or password", "danger")
- return redirect(url_for("root.login"))
+ return redirect(url_for("webmentions.login"))
login_user(user)
next_url = request.args.get("next")
if not next_url or not is_safe_next_url(next_url):
- next_url = url_for("root.index")
+ next_url = url_for("webmentions.index")
return redirect(next_url)
return render_template("login.html", form=form)
-@root_page.route("/logout", methods=("POST",))
+@webmentions_bp.route("/logout", methods=("POST",))
@login_required
def logout() -> ResponseReturnValue:
"""End the current user's login session.
@@ -80,4 +80,4 @@ def logout() -> ResponseReturnValue:
:returns: Redirect response to the application index.
"""
logout_user()
- return redirect(url_for("root.index"))
+ return redirect(url_for("webmentions.index"))