Skip to content
This repository was archived by the owner on May 26, 2020. It is now read-only.

Commit 1a3c66a

Browse files
committed
Merge pull request #12 from stanhu/master
Fix issue #11: Allow null e-mail addresses
2 parents c665d5b + df5cdfa commit 1a3c66a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

rest_framework_jwt/authentication.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,9 @@ def authenticate_credentials(self, payload):
6363
"""
6464
try:
6565
user_id = payload.get('user_id')
66-
email = payload.get('email')
6766

68-
if user_id and email:
69-
user = User.objects.get(pk=user_id, email=email, is_active=True)
67+
if user_id:
68+
user = User.objects.get(pk=user_id, is_active=True)
7069
else:
7170
msg = 'Invalid payload'
7271
raise exceptions.AuthenticationFailed(msg)

rest_framework_jwt/tests/test_authentication.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def test_post_form_passing_jwt_invalid_payload(self):
208208
"""
209209
Ensure POSTing json over JWT auth with invalid payload fails
210210
"""
211-
payload = dict(user_id=1, email=None)
211+
payload = dict(email=None)
212212
token = utils.jwt_encode_handler(payload)
213213

214214
auth = 'JWT {0}'.format(token)

0 commit comments

Comments
 (0)