From 2b4125bffe5a889266f34b71c861187889e9e880 Mon Sep 17 00:00:00 2001 From: drozdowsky Date: Thu, 22 Aug 2019 16:40:26 +0200 Subject: [PATCH] Pass request to django's authenticate --- changelog.d/14.bugfix.md | 1 + src/rest_framework_jwt/serializers.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/14.bugfix.md diff --git a/changelog.d/14.bugfix.md b/changelog.d/14.bugfix.md new file mode 100644 index 00000000..80a2f734 --- /dev/null +++ b/changelog.d/14.bugfix.md @@ -0,0 +1 @@ +Pass `request` to `django.contrib.auth.authenticate`. diff --git a/src/rest_framework_jwt/serializers.py b/src/rest_framework_jwt/serializers.py index 5f11bcff..ab255629 100644 --- a/src/rest_framework_jwt/serializers.py +++ b/src/rest_framework_jwt/serializers.py @@ -82,7 +82,7 @@ def validate(self, data): 'password': data.get('password') } - user = authenticate(**credentials) + user = authenticate(self.context['request'], **credentials) if not user: msg = _('Unable to log in with provided credentials.')