Opened 3 weeks ago
Last modified 2 weeks ago
#37019 assigned Bug
Make sync login() and logout() set request.auser if present
| Reported by: | Jacob Walls | Owned by: | Vishy Algo |
|---|---|---|---|
| Component: | contrib.auth | Version: | 5.0 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Analogous to #37017, we should make sync logout() clear request.auser if present. If auser is not present, I doubt login() should set it, but if it is present, it probably should be set as well.
Change History (3)
comment:1 by , 3 weeks ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:2 by , 3 weeks ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:3 by , 2 weeks ago
| Has patch: | set |
|---|
Note:
See TracTickets
for help on using tickets.
Regression tests from the PR discussion if useful
tests/auth_tests/test_middleware.py
I personally think auser may need to be set as using
sync_to_asyncshould still be valid and perhaps third-party code may have sync only code assuming things will work usingsync_to_async. I understand in your own project you should usealogininstead