mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2025-07-22 05:29:46 +03:00
check for is_open_for_signup method in the adapter on register
This commit is contained in:
parent
e75644b31a
commit
f40c031c80
|
@ -36,7 +36,14 @@ class RegisterView(CreateAPIView):
|
|||
|
||||
@sensitive_post_parameters_m
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super(RegisterView, self).dispatch(*args, **kwargs)
|
||||
# Check if registration is open
|
||||
if get_adapter(self.request).is_open_for_signup(self.request):
|
||||
return super(RegisterView, self).dispatch(*args, **kwargs)
|
||||
else:
|
||||
return Response(
|
||||
data={'message': 'Registration is not open.'},
|
||||
status=status.HTTP_403_FORBIDDEN,
|
||||
)
|
||||
|
||||
def get_response_data(self, user):
|
||||
if allauth_settings.EMAIL_VERIFICATION == \
|
||||
|
|
Loading…
Reference in New Issue
Block a user