Move the user creation feature flag check to the user creation path of the user login post method.
This commit is contained in:
parent
5c68e52fce
commit
a37978c971
1 changed files with 3 additions and 3 deletions
|
@ -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')
|
||||
|
|
Reference in a new issue