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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.auth
3
- Version: 0.10.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)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "plain.auth"
3
- version = "0.10.0"
3
+ version = "0.12.0"
4
4
  description = "User authentication and authorization for Plain."
5
5
  authors = [{name = "Dave Gaeddert", email = "dave.gaeddert@dropseed.dev"}]
6
6
  readme = "README.md"
@@ -1,6 +0,0 @@
1
- from plain.packages import PackageConfig, register_config
2
-
3
-
4
- @register_config
5
- class Config(PackageConfig):
6
- pass
File without changes
File without changes
File without changes