plain.auth 0.20.2__tar.gz → 0.20.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {plain_auth-0.20.2 → plain_auth-0.20.4}/PKG-INFO +1 -1
- {plain_auth-0.20.2 → plain_auth-0.20.4}/plain/auth/CHANGELOG.md +21 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/plain/auth/templates.py +6 -1
- {plain_auth-0.20.2 → plain_auth-0.20.4}/pyproject.toml +1 -1
- {plain_auth-0.20.2 → plain_auth-0.20.4}/.gitignore +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/LICENSE +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/README.md +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/plain/auth/README.md +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/plain/auth/__init__.py +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/plain/auth/default_settings.py +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/plain/auth/requests.py +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/plain/auth/sessions.py +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/plain/auth/test.py +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/plain/auth/utils.py +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/plain/auth/views.py +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/tests/app/settings.py +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/tests/app/urls.py +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/tests/app/users/migrations/0001_initial.py +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/tests/app/users/migrations/__init__.py +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/tests/app/users/models.py +0 -0
- {plain_auth-0.20.2 → plain_auth-0.20.4}/tests/test_views.py +0 -0
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# plain-auth changelog
|
|
2
2
|
|
|
3
|
+
## [0.20.4](https://github.com/dropseed/plain/releases/plain-auth@0.20.4) (2025-10-16)
|
|
4
|
+
|
|
5
|
+
### What's changed
|
|
6
|
+
|
|
7
|
+
- The `get_current_user()` template function now catches `SessionNotAvailable` exceptions and returns `None`, preventing errors during error page rendering before middleware runs ([fb889fa](https://github.com/dropseed/plain/commit/fb889fa0e9))
|
|
8
|
+
|
|
9
|
+
### Upgrade instructions
|
|
10
|
+
|
|
11
|
+
- No changes required
|
|
12
|
+
|
|
13
|
+
## [0.20.3](https://github.com/dropseed/plain/releases/plain-auth@0.20.3) (2025-10-07)
|
|
14
|
+
|
|
15
|
+
### What's changed
|
|
16
|
+
|
|
17
|
+
- Updated 0.20.0 changelog with additional upgrade instructions about `login_required` default ([221591e](https://github.com/dropseed/plain/commit/221591e48a))
|
|
18
|
+
|
|
19
|
+
### Upgrade instructions
|
|
20
|
+
|
|
21
|
+
- No changes required
|
|
22
|
+
|
|
3
23
|
## [0.20.2](https://github.com/dropseed/plain/releases/plain-auth@0.20.2) (2025-10-06)
|
|
4
24
|
|
|
5
25
|
### What's changed
|
|
@@ -33,6 +53,7 @@
|
|
|
33
53
|
|
|
34
54
|
- Remove `plain.auth.middleware.AuthenticationMiddleware` from your `MIDDLEWARE` setting
|
|
35
55
|
- In views, use `AuthViewMixin` for access to `self.user` instead of `self.request.user`
|
|
56
|
+
- The default for `login_required` in `AuthViewMixin` is now `False`, so explicitly set `login_required = True` if needed
|
|
36
57
|
- Replace `request.user` with `get_request_user(request)` in code outside of `AuthViewMixin` views
|
|
37
58
|
- In templates, replace `{{ request.user }}` with `{{ user }}` (from `AuthViewMixin`) or with `{{ get_current_user() }}`
|
|
38
59
|
|
|
@@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any
|
|
|
4
4
|
|
|
5
5
|
from jinja2 import pass_context
|
|
6
6
|
|
|
7
|
+
from plain.sessions.exceptions import SessionNotAvailable
|
|
7
8
|
from plain.templates import register_template_global
|
|
8
9
|
|
|
9
10
|
from .requests import get_request_user
|
|
@@ -18,4 +19,8 @@ def get_current_user(context: Context) -> Any | None:
|
|
|
18
19
|
"""Get the authenticated user for the current request."""
|
|
19
20
|
request = context.get("request")
|
|
20
21
|
assert request is not None, "No request in template context"
|
|
21
|
-
|
|
22
|
+
try:
|
|
23
|
+
return get_request_user(request)
|
|
24
|
+
except SessionNotAvailable:
|
|
25
|
+
# Session not available (e.g., during error page rendering before middleware runs)
|
|
26
|
+
return None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|