Move the user creation feature flag check to the user creation path of the user login post method.

This commit is contained in:
Jake Moshenko 2015-03-02 15:38:03 -05:00
parent 5c68e52fce
commit a37978c971

View file

@ -75,9 +75,6 @@ def generate_headers(scope=GrantType.READ_REPOSITORY):
@index.route('/users', methods=['POST'])
@index.route('/users/', methods=['POST'])
def create_user():
if not features.USER_CREATION:
abort(400, 'User creation is disabled. Please speak to your administrator.')
user_data = request.get_json()
if not user_data or not 'username' in user_data:
abort(400, 'Missing username')
@ -126,6 +123,9 @@ def create_user():
abort(400, 'Invalid password.', issue='login-failure')
elif not features.USER_CREATION:
abort(400, 'User creation is disabled. Please speak to your administrator.')
else:
# New user case
logger.debug('Creating user')