Revert "Revert "Don’t let people create a normal key in trial mode""

Reverts alphagov/notifications-admin#976
This commit is contained in:
Chris Hill-Scott
2016-10-11 09:17:18 +01:00
parent d13dbe5066
commit 645e935f55
2 changed files with 32 additions and 6 deletions

View File

@@ -68,13 +68,12 @@ def create_api_key(service_id):
key['name'] for key in api_key_api_client.get_api_keys(service_id=service_id)['apiKeys']
]
form = CreateKeyForm(key_names)
form.key_type.choices = [
(KEY_TYPE_NORMAL, 'Send messages to anyone{}'.format(
', once this service is not in trial mode' if current_service['restricted'] else ''
)),
form.key_type.choices = filter(None, [
(KEY_TYPE_NORMAL, 'Send messages to anyone{}')
if not current_service['restricted'] else None,
(KEY_TYPE_TEST, 'Simulate sending messages to anyone'),
(KEY_TYPE_TEAM, 'Only send messages to your team or whitelist')
]
])
if form.validate_on_submit():
secret = api_key_api_client.create_api_key(
service_id=service_id,