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-16 15:48:27 -04:00
parent b22174adf5
commit d29044d034
3 changed files with 36 additions and 1 deletions
@@ -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)])