aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/auth.py
diff options
context:
space:
mode:
authorDennis Fink2026-08-19 19:49:55 +0200
committerDennis Fink2026-08-19 19:49:55 +0200
commitd0e245d63e014d268310976fc45429f08d2cbbe9 (patch)
treeef2e96570723190baf02f05c2c4644a19ff1af78 /webmentions_ssg/auth.py
parentd4a03623544aac0ce911d8471ff4b033bc3255e1 (diff)
downloadwebmentions-ssg-d0e245d63e014d268310976fc45429f08d2cbbe9.tar.gz
webmentions-ssg-d0e245d63e014d268310976fc45429f08d2cbbe9.zip
refactor(core): improve typing and test coverage
Restructure database and user CLI commands, make passwords write-only model properties, and use the UTC datetime constant throughout the application. Add PEP 287-style documentation and expand receiver, scanner, sender, and URL security tests to cover error paths and edge cases.
Diffstat (limited to 'webmentions_ssg/auth.py')
-rw-r--r--webmentions_ssg/auth.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/webmentions_ssg/auth.py b/webmentions_ssg/auth.py
index f8fd28c..7bd93a3 100644
--- a/webmentions_ssg/auth.py
+++ b/webmentions_ssg/auth.py
@@ -9,5 +9,11 @@ AUTH.login_view = "root.login"
@AUTH.user_loader
-def load_user(id):
+def load_user(id: int) -> User | None:
+ """
+ Load a user from the database by identifier.
+
+ :param id: User identifier stored in the login session.
+ :return: Matching user, or ``None`` if no user exists with the identifier.
+ """
return db.session.get(User, int(id))