Add a bypass code to allow registration outside Protospace
This commit is contained in:
parent
84b83baf13
commit
f23c3ecc4c
|
@ -405,7 +405,13 @@ class MyRegisterSerializer(RegisterSerializer):
|
||||||
def custom_signup(self, request, user):
|
def custom_signup(self, request, user):
|
||||||
data = request.data
|
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')
|
logger.info('Request not from protospace')
|
||||||
user.delete()
|
user.delete()
|
||||||
raise ValidationError(dict(non_field_errors='Can only register from Protospace.'))
|
raise ValidationError(dict(non_field_errors='Can only register from Protospace.'))
|
||||||
|
|
|
@ -12,6 +12,13 @@ ADMIN_RANDOM = ''
|
||||||
# head /dev/urandom | base32 | head -c 16
|
# head /dev/urandom | base32 | head -c 16
|
||||||
IPN_RANDOM = ''
|
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
|
# Django secret key
|
||||||
# Set this to random characters
|
# Set this to random characters
|
||||||
# For example, use the output of this:
|
# For example, use the output of this:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user