Skip to content

Commit c20a8ce

Browse files
committed
Registration: explicitly set email confirm field to False
1 parent cf05856 commit c20a8ce

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rest_authtoken/serializers.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from rest_framework.exceptions import ValidationError
77

88
from .email_confirmation import send_confirmation_email
9-
from .settings import REGISTRATION_EMAIL_CONFIRM
9+
from .settings import REGISTRATION_EMAIL_CONFIRM, REGISTRATION_EMAIL_CONFIRM_MODEL_FIELD
1010

1111

1212
class UserRegistrationSerializer(serializers.ModelSerializer):
@@ -53,6 +53,10 @@ def create(self, validated_data):
5353

5454
instance = self.Meta.model(**validated_data)
5555
instance.set_password(password)
56+
57+
if REGISTRATION_EMAIL_CONFIRM:
58+
setattr(instance, REGISTRATION_EMAIL_CONFIRM_MODEL_FIELD, False)
59+
5660
instance.save()
5761

5862
if REGISTRATION_EMAIL_CONFIRM:

0 commit comments

Comments
 (0)