diff --git a/apiserver/apiserver/api/serializers.py b/apiserver/apiserver/api/serializers.py index ee7b2fe..b7c0868 100644 --- a/apiserver/apiserver/api/serializers.py +++ b/apiserver/apiserver/api/serializers.py @@ -405,7 +405,13 @@ class MyRegisterSerializer(RegisterSerializer): def custom_signup(self, request, user): data = request.data - if not utils.is_request_from_protospace(request): + if secrets.REGISTRATION_BYPASS: + bypass_code = data.get('bypass_code', None) + allow_bypass = secrets.REGISTRATION_BYPASS == bypass_code + else: + allow_bypass = False + + if not allow_bypass and not utils.is_request_from_protospace(request): logger.info('Request not from protospace') user.delete() raise ValidationError(dict(non_field_errors='Can only register from Protospace.')) diff --git a/apiserver/apiserver/secrets.py.example b/apiserver/apiserver/secrets.py.example index 2e0cca7..305f252 100644 --- a/apiserver/apiserver/secrets.py.example +++ b/apiserver/apiserver/secrets.py.example @@ -12,6 +12,13 @@ ADMIN_RANDOM = '' # head /dev/urandom | base32 | head -c 16 IPN_RANDOM = '' +# Registration bypass code +# Allows people to register outside of protospace +# Set this to random characters +# For example, use the output of this: +# head /dev/urandom | base32 | head -c 16 +REGISTRATION_BYPASS = '' + # Django secret key # Set this to random characters # For example, use the output of this: