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

You can’t properly use a normal key when your service is in trial mode.

It’s theoretically useful to create a live key in preparation for going
live. This utitily outweighs the confusion it causes for people creating
their first keys in trial mode.

We should just remove the confusing option.
This commit is contained in:
Chris Hill-Scott
2016-10-07 14:52:19 +01:00
parent 5bb700ac81
commit 90d4fcaa52
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,