Skip to content

Commit fb9ee19

Browse files
committed
Check that session doesn't contain password
1 parent 9988c50 commit fb9ee19

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_views_login.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
from unittest import mock
23

34
from django.conf import settings
@@ -397,6 +398,19 @@ def test_missing_management_data(self):
397398
# view should return HTTP 400 Bad Request
398399
self.assertEqual(response.status_code, 400)
399400

401+
def test_no_password_in_session(self):
402+
self.create_user()
403+
self.enable_otp()
404+
405+
response = self._post({'auth-username': '[email protected]',
406+
'auth-password': 'secret',
407+
'login_view-current_step': 'auth'})
408+
self.assertContains(response, 'Token:')
409+
410+
session_contents = json.dumps(list(self.client.session.items()))
411+
412+
self.assertNotIn('secret', session_contents)
413+
400414

401415
class BackupTokensTest(UserMixin, TestCase):
402416
def setUp(self):

0 commit comments

Comments
 (0)