Opened 7 years ago

Closed 5 months ago

#12405 closed New feature (fixed)

django.contrib.auth.views.logout() should support LOGOUT_REDIRECT_URL

Reported by: cmwslw Owned by: hobarrera
Component: contrib.auth Version: 1.1
Severity: Normal Keywords: logout LOGOUT_REDIRECT_URL
Cc: mike@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I was wondering why django.contrib.auth.views.logout() doesn't support a REDIRECT_URL override in the settings file as login() does. I'm aware that it is possible to specify a next_page argument, however, this is cumbersome if the urls.py containing logout() is a third party library such as django-registration. I haven't taken a good look at the source, but I am guessing this would be a simple patch to write in order to support LOGOUT_REDIRECT_URL. Before I work on it, I need to know if there are any possible regressions or if there are any opinions against this.

Change History (19)

comment:1 in reply to: ↑ description Changed 6 years ago by dloewenherz

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to dloewenherz
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by dloewenherz

  • Needs documentation set
  • Needs tests set

comment:3 Changed 6 years ago by cmwslw

dloewenherz: are you a triager giving me the go-ahead for writing a patch like this, or are you claiming the bug yourself? Either way, I'm still interested in seeing this patch hopefully make it into trunk.

comment:4 Changed 6 years ago by dloewenherz

I'm claiming it, although I wouldn't exactly call it a bug ;).

Did you already have a patch?

comment:5 Changed 6 years ago by cmwslw

I don't have a patch, I was just making sure you were claiming it. If you end up not being able to work on it, I could if I have time.

comment:6 Changed 6 years ago by anonymous

Please see ticket #11223.

comment:7 Changed 5 years ago by mattmcc

  • Severity set to Normal
  • Type set to New feature

comment:8 Changed 5 years ago by carbonXT

  • Cc mike@… added

comment:9 Changed 4 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:10 Changed 4 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:11 Changed 3 years ago by bigkevmcd

  • Owner changed from dloewenherz to bigkevmcd

comment:12 Changed 2 years ago by anonymous

So? What's the status?

comment:13 Changed 2 years ago by anonymous

  • Owner bigkevmcd deleted
  • Status changed from assigned to new

comment:14 Changed 16 months ago by cbarcenas

  • Owner set to cbarcenas
  • Status changed from new to assigned

comment:15 Changed 16 months ago by cbarcenas

Picking this one up as my first contribution to Django :) I don't anticipate this taking more than a few lines of code and a test or two.

https://github.com/cbarcenas/django/tree/ticket_12405

Last edited 16 months ago by cbarcenas (previous) (diff)

comment:16 Changed 10 months ago by hobarrera

I've implemented a PR for this, based on changes that implemented this on a specific project:

https://github.com/django/django/pull/5193

Let me know if there's anything that need tweaking.

comment:17 Changed 10 months ago by timgraham

  • Has patch set
  • Needs documentation unset

Tests are missing. Please uncheck "Needs tests" on the ticket when you update it so the ticket appears in the review queue, thanks!

comment:18 Changed 5 months ago by hobarrera

  • Needs tests unset
  • Owner changed from cbarcenas to hobarrera

comment:19 Changed 5 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In dcee1dfc:

Fixed #12405 -- Added LOGOUT_REDIRECT_URL setting.

After a user logs out via auth.views.logout(), they're redirected
to LOGOUT_REDIRECT_URL if no next_page argument is provided.

Note: See TracTickets for help on using tickets.
Back to Top