Fix post login redirection to honor the ?next= URL query string

argument. Thanks go to K.C. Wong (@dvusboy1) for the report and investigation.
Closes GitLab issue #489.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-08-04 01:36:57 -04:00
parent 42ea33d760
commit cc62988d4d
3 changed files with 38 additions and 2 deletions

View File

@@ -205,3 +205,18 @@ class UserLoginTestCase(BaseTestCase):
response = self.client.get(reverse('documents:document_list'))
self.assertEqual(response.status_code, 200)
def test_username_login_redirect(self):
TEST_REDIRECT_URL = '/about/'
response = self.client.post(
'{}?next={}'.format(
reverse(settings.LOGIN_URL), TEST_REDIRECT_URL
), {
'username': TEST_ADMIN_USERNAME,
'password': TEST_ADMIN_PASSWORD,
'remember_me': False
}, follow=True
)
self.assertEqual(response.redirect_chain, [(TEST_REDIRECT_URL, 302)])