Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions vulnerabilities/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ class AdvisorySearchForm(forms.Form):
class ApiUserCreationForm(forms.ModelForm):
"""Support a simplified creation for API-only users directly from the UI."""

captcha = AltchaField(
floating=True,
hidefooter=True,
hidelogo=True,
)
captcha = AltchaField(floating=True, hidefooter=True)

class Meta:
model = ApiUser
Expand All @@ -66,18 +62,15 @@ def __init__(self, *args, **kwargs):
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"
email_field.widget.attrs["placeholder"] = "Email"
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"
first_name_field.widget.attrs["placeholder"] = "First Name"
last_name_field.widget.attrs["class"] = "input"
last_name_field.widget.attrs["style"] = "width: 50%"
last_name_field.widget.attrs["placeholder"] = "Doe"
last_name_field.widget.attrs["placeholder"] = "Last Name"
email_field.label = ""
first_name_field.label = ""
last_name_field.label = ""

def save(self, commit=True):
return ApiUser.objects.create_api_user(
Expand Down Expand Up @@ -109,8 +102,4 @@ class PipelineSchedulePackageForm(forms.Form):


class AdminLoginForm(AdminAuthenticationForm):
captcha = AltchaField(
floating=True,
hidefooter=True,
hidelogo=True,
)
captcha = AltchaField(floating=True, hidefooter=True)
32 changes: 9 additions & 23 deletions vulnerabilities/templates/api_user_creation_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
VulnerableCode API key request
{% endblock %}



{% block content %}
<section class="section pt-0">
{% for message in messages %}
Expand Down Expand Up @@ -44,31 +46,15 @@ <h1 class="title is-4">VulnerableCode API Key Request</h1>

<br/>
<div class="columns is-centered">
<div class="column is-half">
<div class="column is-one-third">
<form method = "post">
{% csrf_token %}
<div class="field">
<div class="control">
<input class="input" placeholder="Email" type="email" name="email" id="{{form.email.id_for_label}}"
autofocus required >
</div>
</div>
<div class="field">
<div class="control">
<input class="input" placeholder="First Name" type="text" name="first_name" id="{{form.first_name.id_for_label}}"
autofocus required>
</div>
</div>
<div class="field">
<div class="control">
<input class="input" placeholder="Last Name" type="text" name="last_name" id="{{form.last_name.id_for_label}}"
autofocus required>
</div>
</div>
<div class="field">
{{ form.captcha }}
</div>
<input class="button is-link mt-5" type="submit" value="Request my API Key">
{% for field in form %}
<p class="mb-4">
{{ field }}
</p>
{% endfor %}
<input class="button is-link mt-2" type="submit" value="Request my API Key">
</form>
</div>
</div>
Expand Down