Skip to content

Commit 1c0449b

Browse files
committed
Fix altcha form
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent fdaaddd commit 1c0449b

File tree

3 files changed

+20
-32
lines changed

3 files changed

+20
-32
lines changed

etc/nginx/conf.d/default.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ upstream gunicorn_app {
44

55
server {
66
listen 80;
7+
http2 on;
8+
server_tokens off;
79

10+
gzip on;
11+
gzip_comp_level 6;
12+
gzip_types text/css text/javascript application/javascript image/svg+xml;
813
location / {
914
proxy_pass http://gunicorn_app;
1015
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

vulnerabilities/forms.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,15 @@ def __init__(self, *args, **kwargs):
6666
first_name_field = self.fields["first_name"]
6767
last_name_field = self.fields["last_name"]
6868
email_field.required = True
69-
email_field.label = "Email"
7069
email_field.widget.attrs["class"] = "input"
71-
email_field.widget.attrs["style"] = "width: 50%"
72-
email_field.widget.attrs["placeholder"] = "foo@bar.com"
73-
first_name_field.label = "First Name"
70+
email_field.widget.attrs["placeholder"] = "Email"
7471
first_name_field.widget.attrs["class"] = "input"
75-
first_name_field.widget.attrs["style"] = "width: 50%"
76-
first_name_field.widget.attrs["placeholder"] = "Jon"
77-
last_name_field.label = "Last Name"
72+
first_name_field.widget.attrs["placeholder"] = "First Name"
7873
last_name_field.widget.attrs["class"] = "input"
79-
last_name_field.widget.attrs["style"] = "width: 50%"
80-
last_name_field.widget.attrs["placeholder"] = "Doe"
74+
last_name_field.widget.attrs["placeholder"] = "Last Name"
75+
email_field.label = ""
76+
first_name_field.label = ""
77+
last_name_field.label = ""
8178

8279
def save(self, commit=True):
8380
return ApiUser.objects.create_api_user(

vulnerabilities/templates/api_user_creation_form.html

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
VulnerableCode API key request
55
{% endblock %}
66

7+
8+
79
{% block content %}
810
<section class="section pt-0">
911
{% for message in messages %}
@@ -44,31 +46,15 @@ <h1 class="title is-4">VulnerableCode API Key Request</h1>
4446

4547
<br/>
4648
<div class="columns is-centered">
47-
<div class="column is-half">
49+
<div class="column is-one-third">
4850
<form method = "post">
4951
{% csrf_token %}
50-
<div class="field">
51-
<div class="control">
52-
<input class="input" placeholder="Email" type="email" name="email" id="{{form.email.id_for_label}}"
53-
autofocus required >
54-
</div>
55-
</div>
56-
<div class="field">
57-
<div class="control">
58-
<input class="input" placeholder="First Name" type="text" name="first_name" id="{{form.first_name.id_for_label}}"
59-
autofocus required>
60-
</div>
61-
</div>
62-
<div class="field">
63-
<div class="control">
64-
<input class="input" placeholder="Last Name" type="text" name="last_name" id="{{form.last_name.id_for_label}}"
65-
autofocus required>
66-
</div>
67-
</div>
68-
<div class="field">
69-
{{ form.captcha }}
70-
</div>
71-
<input class="button is-link mt-5" type="submit" value="Request my API Key">
52+
{% for field in form %}
53+
<p class="mb-4">
54+
{{ field }}
55+
</p>
56+
{% endfor %}
57+
<input class="button is-link mt-2" type="submit" value="Request my API Key">
7258
</form>
7359
</div>
7460
</div>

0 commit comments

Comments
 (0)