Browse Source

Fix: Fix bug in register aftter login

pull/169/head
winkidney 5 years ago
committed by Isaac Bythewood
parent
commit
a268a886e0
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      users/serializers.py

+ 8
- 0
users/serializers.py View File

@@ -1,4 +1,7 @@
from copy import deepcopy

from django.conf import settings
from django.contrib.auth import login
from rest_framework import serializers
from rest_framework.exceptions import ValidationError

@@ -51,4 +54,9 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
)
user.set_password(password)
user.save()
login(
self.context['request'],
user=user,
backend=settings.AUTHENTICATION_BACKENDS[0],
)
return user

Loading…
Cancel
Save