plain.auth 0.10.0__tar.gz → 0.12.0__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.10.0 → plain_auth-0.12.0}/PKG-INFO +1 -3
- {plain_auth-0.10.0 → plain_auth-0.12.0}/plain/auth/README.md +0 -2
- {plain_auth-0.10.0 → plain_auth-0.12.0}/plain/auth/sessions.py +14 -0
- {plain_auth-0.10.0 → plain_auth-0.12.0}/pyproject.toml +1 -1
- plain_auth-0.10.0/plain/auth/config.py +0 -6
- {plain_auth-0.10.0 → plain_auth-0.12.0}/.gitignore +0 -0
- {plain_auth-0.10.0 → plain_auth-0.12.0}/LICENSE +0 -0
- {plain_auth-0.10.0 → plain_auth-0.12.0}/README.md +0 -0
- {plain_auth-0.10.0 → plain_auth-0.12.0}/plain/auth/__init__.py +0 -0
- {plain_auth-0.10.0 → plain_auth-0.12.0}/plain/auth/default_settings.py +0 -0
- {plain_auth-0.10.0 → plain_auth-0.12.0}/plain/auth/middleware.py +0 -0
- {plain_auth-0.10.0 → plain_auth-0.12.0}/plain/auth/utils.py +0 -0
- {plain_auth-0.10.0 → plain_auth-0.12.0}/plain/auth/views.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plain.auth
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.0
|
|
4
4
|
Summary: User authentication and authorization for Plain.
|
|
5
5
|
Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
|
|
6
6
|
License-File: LICENSE
|
|
@@ -78,7 +78,6 @@ urlpatterns = [
|
|
|
78
78
|
]
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
|
|
82
81
|
## Checking if a user is logged in
|
|
83
82
|
|
|
84
83
|
A `request.user` will either be `None` or point to an instance of a your `AUTH_USER_MODEL`.
|
|
@@ -102,7 +101,6 @@ else:
|
|
|
102
101
|
print("You are not logged in.")
|
|
103
102
|
```
|
|
104
103
|
|
|
105
|
-
|
|
106
104
|
## Restricting views
|
|
107
105
|
|
|
108
106
|
Use the `AuthViewMixin` to restrict views to logged in users, admin users, or custom logic.
|
|
@@ -66,7 +66,6 @@ urlpatterns = [
|
|
|
66
66
|
]
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
|
|
70
69
|
## Checking if a user is logged in
|
|
71
70
|
|
|
72
71
|
A `request.user` will either be `None` or point to an instance of a your `AUTH_USER_MODEL`.
|
|
@@ -90,7 +89,6 @@ else:
|
|
|
90
89
|
print("You are not logged in.")
|
|
91
90
|
```
|
|
92
91
|
|
|
93
|
-
|
|
94
92
|
## Restricting views
|
|
95
93
|
|
|
96
94
|
Use the `AuthViewMixin` to restrict views to logged in users, admin users, or custom logic.
|
|
@@ -21,6 +21,20 @@ def get_session_auth_hash(user):
|
|
|
21
21
|
return _get_session_auth_hash(user)
|
|
22
22
|
|
|
23
23
|
|
|
24
|
+
def update_session_auth_hash(request, user):
|
|
25
|
+
"""
|
|
26
|
+
Updating a user's password (for example) logs out all sessions for the user.
|
|
27
|
+
|
|
28
|
+
Take the current request and the updated user object from which the new
|
|
29
|
+
session hash will be derived and update the session hash appropriately to
|
|
30
|
+
prevent a password change from logging out the session from which the
|
|
31
|
+
password was changed.
|
|
32
|
+
"""
|
|
33
|
+
request.session.cycle_key()
|
|
34
|
+
if request.user == user:
|
|
35
|
+
request.session[USER_HASH_SESSION_KEY] = get_session_auth_hash(user)
|
|
36
|
+
|
|
37
|
+
|
|
24
38
|
def get_session_auth_fallback_hash(user):
|
|
25
39
|
for fallback_secret in settings.SECRET_KEY_FALLBACKS:
|
|
26
40
|
yield _get_session_auth_hash(user, secret=fallback_secret)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|