Skip to content

Commit ba5edba

Browse files
author
Mateusz Sikora
committed
fix update_session_auth_hash for django <1.7
1 parent 6ba1916 commit ba5edba

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

rest_auth/serializers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
from django.utils.http import base36_to_int as uid_decoder
99
from django.contrib.auth.tokens import default_token_generator
1010
from django.utils.translation import ugettext_lazy as _
11+
from django import VERSION
1112

1213
from rest_framework import serializers, exceptions
1314
from rest_framework.authtoken.models import Token
1415
from rest_framework.exceptions import ValidationError
15-
from django.contrib.auth import update_session_auth_hash
1616

1717

1818
class LoginSerializer(serializers.Serializer):
@@ -216,5 +216,6 @@ def validate(self, attrs):
216216

217217
def save(self):
218218
self.set_password_form.save()
219-
if not self.logout_on_password_change:
219+
if VERSION[1] > 6 and not self.logout_on_password_change:
220+
from django.contrib.auth import update_session_auth_hash
220221
update_session_auth_hash(self.request, self.user)

0 commit comments

Comments
 (0)