Opened 7 years ago

Closed 10 months ago

#12405 closed New feature (fixed)

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

Reported by: Cory Walker Owned by: Hugo Osvaldo Barrera
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 7 years ago by Dan Loewenherz

Owner: changed from nobody to Dan Loewenherz
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by Dan Loewenherz

Needs documentation: set
Needs tests: set

comment:3 Changed 7 years ago by Cory Walker

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 7 years ago by Dan Loewenherz

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

Did you already have a patch?

comment:5 Changed 7 years ago by Cory Walker

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 7 years ago by anonymous

Please see ticket #11223.

comment:7 Changed 6 years ago by Matt McClanahan

Severity: Normal
Type: New feature

comment:8 Changed 6 years ago by Mike Fogel

Cc: mike@… added

comment:9 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:10 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:11 Changed 3 years ago by bigkevmcd

Owner: changed from Dan Loewenherz to bigkevmcd

comment:12 Changed 3 years ago by anonymous

So? What's the status?

comment:13 Changed 3 years ago by anonymous

Owner: bigkevmcd deleted
Status: assignednew

comment:14 Changed 22 months ago by Christian Barcenas

Owner: set to Christian Barcenas
Status: newassigned

comment:15 Changed 22 months ago by Christian Barcenas

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 22 months ago by Christian Barcenas (previous) (diff)

comment:16 Changed 16 months ago by Hugo Osvaldo Barrera

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 16 months ago by Tim Graham

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 10 months ago by Hugo Osvaldo Barrera

Needs tests: unset
Owner: changed from Christian Barcenas to Hugo Osvaldo Barrera

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

Resolution: fixed
Status: assignedclosed

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