mirror of
https://github.com/django/django.git
synced 2025-08-21 01:09:13 +00:00
Refs #35303 -- Made small optimizations in alogout() and aget_user().
In alogout(), there is no need to check the is_authenticated attribute when user is None. In aget_user(), there is no need to call get_session_auth_hash() twice. Follow up to 50f89ae850f6b4e35819fe725a08c7e579bfd099.
This commit is contained in:
parent
cd7554e551
commit
7063d31cc3
@ -364,8 +364,8 @@ async def aget_user(request):
|
|||||||
session_hash_verified = False
|
session_hash_verified = False
|
||||||
else:
|
else:
|
||||||
session_auth_hash = user.get_session_auth_hash()
|
session_auth_hash = user.get_session_auth_hash()
|
||||||
session_hash_verified = session_hash and constant_time_compare(
|
session_hash_verified = constant_time_compare(
|
||||||
session_hash, user.get_session_auth_hash()
|
session_hash, session_auth_hash
|
||||||
)
|
)
|
||||||
if not session_hash_verified:
|
if not session_hash_verified:
|
||||||
# If the current secret does not verify the session, try
|
# If the current secret does not verify the session, try
|
||||||
|
Loading…
x
Reference in New Issue
Block a user