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:
@@ -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)])
|
||||
|
||||
Reference in New Issue
Block a user