File tree Expand file tree Collapse file tree 4 files changed +54
-29
lines changed Expand file tree Collapse file tree 4 files changed +54
-29
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ Version v30.3.2
77----------------
88
99- We re-enabled support for the PostgreSQL securities advisories importer.
10+ - We fixed the API key request form UI and made it consistent with rest of UI.
1011
1112
1213Version v30.3.1
Original file line number Diff line number Diff line change @@ -48,7 +48,22 @@ class Meta:
4848
4949 def __init__ (self , * args , ** kwargs ):
5050 super (ApiUserCreationForm , self ).__init__ (* args , ** kwargs )
51- self .fields ["email" ].required = True
51+ email_field = self .fields ["email" ]
52+ first_name_field = self .fields ["first_name" ]
53+ last_name_field = self .fields ["last_name" ]
54+ email_field .required = True
55+ email_field .label = "Email"
56+ email_field .widget .attrs ["class" ] = "input"
57+ email_field .widget .attrs ["style" ] = "width: 50%"
58+ email_field .
widget .
attrs [
"placeholder" ]
= "[email protected] " 59+ first_name_field .label = "First Name"
60+ first_name_field .widget .attrs ["class" ] = "input"
61+ first_name_field .widget .attrs ["style" ] = "width: 50%"
62+ first_name_field .widget .attrs ["placeholder" ] = "Jon"
63+ last_name_field .label = "Last Name"
64+ last_name_field .widget .attrs ["class" ] = "input"
65+ last_name_field .widget .attrs ["style" ] = "width: 50%"
66+ last_name_field .widget .attrs ["placeholder" ] = "Doe"
5267
5368 def save (self , commit = True ):
5469 return ApiUser .objects .create_api_user (
Original file line number Diff line number Diff line change 11{% extends "base.html" %}
22{%load crispy_forms_tags %}
3-
3+ {% block title %}
4+ VulnerableCode API key request
5+ {% endblock %}
46
57{% block content %}
68 < section class ="section pt-0 ">
1113 </ div >
1214 </ article >
1315 {% endfor %}
14- {% block title %}
15- VulnerableCode API key request
16- {% endblock %}
16+ < div id ="form-errors " class ="message is-danger {% if not form.errors %}is-hidden{% endif %} ">
17+ {% for field_name, errors in form.errors.items %}
18+ < div class ="message-body ">
19+ {{ errors }}
20+ </ div >
21+ {% endfor %}
22+ </ div >
23+ < h2 class ="subtitle mb-0 pt-2 mb-2 ">
24+ < b > VulnerableCode API key request</ b >
25+ </ h2 >
26+
27+ < section class ="ml-2 mt-3 pr-4 pt-4 pl-4 pb-4 has-background-light has-border-radius ">
28+ < p class ="pb-2 "> You need an < b > API key</ b > to access the
29+ < a href ="{% url 'api-root' %} "> VulnerableCode JSON REST API</ a > .
30+ Please check the live < a href ="{% url 'api_docs' %} "> OpenAPI documentation </ a >
31+ to learn how to use < a href ="{% url 'api-root' %} "> the API</ a > .
32+ By using this API, you agree to the VulnerableCode.io < a href ="/tos "> Terms of Service</ a > .
33+ This < b > API key</ b > gives you a throttled access to the API and helps to prevent abuse of the API.
34+ </ p >
35+ </ section >
36+
1737 < br />
1838 < form action = "" method = "post ">
1939 {% csrf_token %}
20- {{form|crispy }}
21- < br />
22- < input class ="button is-link " type ="submit " value ="Submit ">
40+ {% for field in form %}
41+ < div class ="field mt-2 ">
42+ < label class ="label " for ="{{ form.name.id_for_label }} "> {{ field.label }}</ label >
43+ < div class ="control ">
44+ {{ field }}
45+ </ div >
46+ </ div >
47+ {% endfor %}
48+ < input class ="button is-link mt-5 " type ="submit " value ="Request my API Key ">
2349 </ form >
2450 </ section >
2551{% endblock %}
Original file line number Diff line number Diff line change 1818 </ div >
1919 </ div >
2020 < div class ="navbar-end mr-3 ">
21+ < a class ="navbar-item " href ="{% url 'api_user_request' %} " target ="_blank ">
22+ API
23+ </ a >
2124 < div class ="navbar-item navbar-item is-cursor-help ">
2225 < div class ="dropdown is-right is-hoverable ">
23- < div class ="dropdown-trigger has-text-grey-light ">
24- API
25- </ div >
26- < div class ="dropdown-menu navbar-hover-div " role ="menu ">
27- < div class ="dropdown-content ">
28- < div class ="dropdown-item about-hover-div ">
29- If you want to try the JSON REST API for VulnerableCode.io,
30- first < a href ="{% url 'api_user_request' %} "> request an API key</ a > ,
31- then < a href ="{% url 'api_docs' %} "> visit the live OpenAPI documentation</ a > ,
32- and < a href ="{% url 'api_docs' %} "> the API endpoint</ a > .
33- Note that API access may be throttled.
34- </ div >
35- </ div >
36- </ div >
37- </ div >
38- </ div >
39- < div class ="navbar-item navbar-item is-cursor-help ">
40- < div class ="dropdown is-right is-hoverable ">
41- < div class ="dropdown-trigger has-text-grey-light ">
42- About
43- </ div >
26+ < div class ="dropdown-trigger has-text-grey-light "> About</ div >
4427 < div class ="dropdown-menu navbar-hover-div " role ="menu ">
4528 < div class ="dropdown-content ">
4629 < div class ="dropdown-item about-hover-div ">
You can’t perform that action at this time.
0 commit comments