diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 158233f81..397e104cb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,7 @@ Version v30.3.2 ---------------- - We re-enabled support for the PostgreSQL securities advisories importer. +- We fixed the API key request form UI and made it consistent with rest of UI. Version v30.3.1 diff --git a/vulnerabilities/forms.py b/vulnerabilities/forms.py index 566d94543..793936c72 100644 --- a/vulnerabilities/forms.py +++ b/vulnerabilities/forms.py @@ -48,7 +48,22 @@ class Meta: def __init__(self, *args, **kwargs): super(ApiUserCreationForm, self).__init__(*args, **kwargs) - self.fields["email"].required = True + email_field = self.fields["email"] + first_name_field = self.fields["first_name"] + last_name_field = self.fields["last_name"] + email_field.required = True + email_field.label = "Email" + email_field.widget.attrs["class"] = "input" + email_field.widget.attrs["style"] = "width: 50%" + email_field.widget.attrs["placeholder"] = "foo@bar.com" + first_name_field.label = "First Name" + first_name_field.widget.attrs["class"] = "input" + first_name_field.widget.attrs["style"] = "width: 50%" + first_name_field.widget.attrs["placeholder"] = "Jon" + last_name_field.label = "Last Name" + last_name_field.widget.attrs["class"] = "input" + last_name_field.widget.attrs["style"] = "width: 50%" + last_name_field.widget.attrs["placeholder"] = "Doe" def save(self, commit=True): return ApiUser.objects.create_api_user( diff --git a/vulnerabilities/templates/api_user_creation_form.html b/vulnerabilities/templates/api_user_creation_form.html index acd473016..c7b2291f0 100644 --- a/vulnerabilities/templates/api_user_creation_form.html +++ b/vulnerabilities/templates/api_user_creation_form.html @@ -1,6 +1,8 @@ {% extends "base.html" %} {%load crispy_forms_tags %} - +{% block title %} +VulnerableCode API key request +{% endblock %} {% block content %}
@@ -11,15 +13,39 @@ {% endfor %} - {% block title %} - VulnerableCode API key request - {% endblock %} +
+ {% for field_name, errors in form.errors.items %} +
+ {{ errors }} +
+ {% endfor %} +
+

+ VulnerableCode API key request +

+ +
+

You need an API key to access the + VulnerableCode JSON REST API. + Please check the live OpenAPI documentation + to learn how to use the API. + By using this API, you agree to the VulnerableCode.io Terms of Service. + This API key gives you a throttled access to the API and helps to prevent abuse of the API. +

+
+
{% csrf_token %} - {{form|crispy }} -
- + {% for field in form %} +
+ +
+ {{ field }} +
+
+ {% endfor %} +
{% endblock %} diff --git a/vulnerabilities/templates/navbar.html b/vulnerabilities/templates/navbar.html index 2f6bac32a..1722726d7 100644 --- a/vulnerabilities/templates/navbar.html +++ b/vulnerabilities/templates/navbar.html @@ -18,29 +18,12 @@