Pin sessions to the user agent in use

This commit is contained in:
Raphael Michel
2018-02-19 12:56:16 +01:00
parent aecb536a34
commit 072f2a0ee9
4 changed files with 66 additions and 25 deletions

View File

@@ -598,3 +598,12 @@ class SessionTimeOutTest(TestCase):
self.assertEqual(response.status_code, 200)
assert self.client.session['pretix_auth_last_used'] > t1
def test_pinned_user_agent(self):
self.client.defaults['HTTP_USER_AGENT'] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36'
response = self.client.get('/control/')
self.assertEqual(response.status_code, 200)
self.client.defaults['HTTP_USER_AGENT'] = 'Mozilla/5.0 (X11; Linux x86_64) Something else'
response = self.client.get('/control/')
self.assertEqual(response.status_code, 302)