Opened 5 years ago

Closed 4 years ago

#31443 closed Bug (fixed)

LoginRequiredMixin/AccessMixin bug with off-site LOGIN_URL

Reported by: minusf Owned by: minusf
Component: contrib.auth Version: dev
Severity: Normal Keywords: login required
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The class based "login required" mechanism lost a bit of functionality compared to its decorator sister: it always sends request.get_full_path(), even for off-site LOGIN_URLs.

https://github.com/django/django/blob/master/django/contrib/auth/mixins.py#L44
vs
https://github.com/django/django/blob/master/django/contrib/auth/decorators.py#L22-L33

The patch is trivial and i will make the PR after i'll know the ticket number.

Change History (10)

comment:2 by Carlton Gibson, 5 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted

OK, thanks. Looks right at a first glance, but the patch needs a test case showing the exact issue.

(Is user_passes_test covered for this case? Could add any missing tests in a separate commit...)

👍

comment:3 by minusf, 5 years ago

i have added a test case. PermissionRequiredMixin is tested "indirectly" as it also inherits from AccessMixin.

comment:4 by minusf, 5 years ago

ping?

in reply to:  4 comment:5 by Mariusz Felisiak, 5 years ago

Replying to minusf:

ping?

Please don't. Pinging doesn't help, you have to be patience.

comment:6 by 28Rahul28, 4 years ago

Owner: changed from nobody to 28Rahul28
Status: newassigned

comment:7 by 28Rahul28, 4 years ago

I am bit confused i see that tests have been made in https://github.com/django/django/pull/12692.

Last edited 4 years ago by 28Rahul28 (previous) (diff)

comment:8 by Mariusz Felisiak, 4 years ago

Needs tests: unset
Owner: changed from 28Rahul28 to minusf

28Rahul28, this ticket already has a patch that is waiting for another review.

comment:9 by Mariusz Felisiak, 4 years ago

Triage Stage: AcceptedReady for checkin
Version: 3.0master

comment:10 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In cc7c16af:

Fixed #31443 -- Fixed login redirection in auth mixins when LOGIN_URL is off-site URL.

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