Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add redirect_field_name to LoginView context to fix "next" #369

Closed
wants to merge 1 commit into from

Conversation

merito
Copy link

@merito merito commented Jul 27, 2020

Description

Based on https://github.com/django/django/blob/f4e93919e4608cfc50849a1f764fd856e0917401/django/contrib/auth/views.py#L99

Motivation and Context

It resolves #214

How Has This Been Tested?

Tested with Django==3.0.7 and it works as expected.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Jul 27, 2020

Codecov Report

Merging #369 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #369   +/-   ##
=======================================
  Coverage   96.85%   96.85%           
=======================================
  Files          39       39           
  Lines        2033     2034    +1     
  Branches      149      149           
=======================================
+ Hits         1969     1970    +1     
  Misses         39       39           
  Partials       25       25           
Impacted Files Coverage Δ
two_factor/views/core.py 94.36% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3dc446c...a682bdf. Read the comment docs.

Copy link
Collaborator

@moggers87 moggers87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There need to be tests. In particular, there need to be tests that would fail without this fix.

@merito
Copy link
Author

merito commented Jul 27, 2020

There need to be tests. In particular, there need to be tests that would fail without this fix.

True. I've tried to write a test which fails without this change and I've realized that the issue is not there ;)

@merito merito closed this Jul 27, 2020
@merito merito deleted the redirect_field_name branch July 27, 2020 21:43
@ex5
Copy link

ex5 commented Feb 2, 2022

I've just ran into the same issue: our existing service relies on next being handled the way it's handled in the builtin LoginView, and this exact change fixes the problem.

I've tried to write a test which fails without this change and I've realized that the issue is not there ;)

@merito could you elaborate on this? What do you mean "the issue is not there"?

Otherwise I'd like to try and make the missing test if it helps getting this merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"next" param ignored in some cases
4 participants