@@ -31,6 +31,8 @@ class SignupView(generics.GenericAPIView):
31
31
email confirmation instance using the ID and call the confirm
32
32
method. To use a field that's not named 'id', define the setting
33
33
email_confirmation_lookup_param (this will change the URL pattern).
34
+
35
+ If the setting is false, the user will be active immediately.
34
36
"""
35
37
authentication_classes = ()
36
38
permission_classes = ()
@@ -48,13 +50,18 @@ def post(self, request):
48
50
"""
49
51
deserializer = self .get_serializer (data = request .data )
50
52
deserializer .is_valid (raise_exception = True )
51
- user = deserializer .save ()
52
53
53
- if self .email_confirmation_class is None :
54
- raise MissingSetting ('email_confirmation_string' )
54
+ confirm_email = get_setting ('email_confirmation_send_email' , True )
55
+
56
+ if not confirm_email :
57
+ deserializer .save (is_active = True )
58
+ else :
59
+ user = deserializer .save ()
60
+
61
+ if self .email_confirmation_class is None :
62
+ raise MissingSetting ('email_confirmation_class' )
55
63
56
- confirmation = self .email_confirmation_class .objects .create (user = user )
57
- if get_setting ('email_confirmation_send_email' , True ):
64
+ confirmation = self .email_confirmation_class .objects .create (user = user )
58
65
email_field = user .get_email_field_name ()
59
66
send_email (request , user , getattr (user , email_field ), confirmation )
60
67
0 commit comments