Skip to content

Commit e86ac0f

Browse files
authored
Bugfix/autoescape (#35)
* rename all j2 files back to html * add Markup to dashboard to render tables from macros
1 parent 061f40f commit e86ac0f

34 files changed

+91
-90
lines changed

config.example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ class Config():
88
# Flask testing
99
TESTING = False
1010
# SSO auth enabled
11-
SSO_AUTH = False
11+
SSO_AUTH = True
1212
# Authentication is done outside the app, use HTTP header to get the user uuid.
1313
# If SSO_AUTH is set to True, this option is ignored and SSO auth is used.
14-
HEADER_AUTH = True
14+
HEADER_AUTH = False
1515
# Name of HTTP header containing the UUID of authenticated user.
1616
# Only used when HEADER_AUTH is set to True
1717
AUTH_HEADER_NAME = 'X-Authenticated-User'

flowapp/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ def logout():
8787
def ext_login():
8888
header_name = app.config.get("AUTH_HEADER_NAME", 'X-Authenticated-User')
8989
if header_name not in request.headers:
90-
return render_template("errors/401.j2")
90+
return render_template("errors/401.html")
9191
uuid = request.headers.get(header_name)
9292
if uuid:
9393
try:
9494
_register_user_to_session(uuid)
9595
except AttributeError:
96-
return render_template("errors/401.j2")
96+
return render_template("errors/401.html")
9797
return redirect("/")
9898

9999
@app.route("/")
@@ -136,12 +136,12 @@ def shutdown_session(exception=None):
136136
# HTTP error handling
137137
@app.errorhandler(404)
138138
def not_found(error):
139-
return render_template("errors/404.j2"), 404
139+
return render_template("errors/404.html"), 404
140140

141141
@app.errorhandler(500)
142142
def internal_error(exception):
143143
app.logger.error(exception)
144-
return render_template("errors/500.j2"), 500
144+
return render_template("errors/500.html"), 500
145145

146146
@app.context_processor
147147
def utility_processor():

flowapp/instance_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,23 @@ class InstanceConfig:
9999
DASHBOARD = {
100100
"ipv4": {
101101
"name": "IPv4",
102-
"macro_file": "macros.j2",
102+
"macro_file": "macros.html",
103103
"macro_tbody": "build_ip_tbody",
104104
"macro_thead": "build_rules_thead",
105105
"table_colspan": 10,
106106
"table_columns": RULES_COLUMNS_V6,
107107
},
108108
"ipv6": {
109109
"name": "IPv6",
110-
"macro_file": "macros.j2",
110+
"macro_file": "macros.html",
111111
"macro_tbody": "build_ip_tbody",
112112
"macro_thead": "build_rules_thead",
113113
"table_colspan": 10,
114114
"table_columns": RULES_COLUMNS_V6,
115115
},
116116
"rtbh": {
117117
"name": "RTBH",
118-
"macro_file": "macros.j2",
118+
"macro_file": "macros.html",
119119
"macro_tbody": "build_rtbh_tbody",
120120
"macro_thead": "build_rules_thead",
121121
"table_colspan": 5,

flowapp/templates/errors/401.j2 renamed to flowapp/templates/errors/401.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends 'layouts/default.j2' %}
1+
{% extends 'layouts/default.html' %}
22
{% block content %}
33
<h1>Could not log you in.</h1>
44
<p class="form-text">401: Unauthorized</p>

flowapp/templates/errors/404.j2 renamed to flowapp/templates/errors/404.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends 'layouts/default.j2' %}
1+
{% extends 'layouts/default.html' %}
22
{% block content %}
33
<h1>Sorry ...</h1>
44
<p>There's nothing here!</p>

flowapp/templates/errors/500.j2 renamed to flowapp/templates/errors/500.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends 'layouts/default.j2' %}
1+
{% extends 'layouts/default.html' %}
22
{% block content %}
33
<h1>Error ...</h1>
44
<p>Sorry ;-)</p>

flowapp/templates/forms/api_key.j2 renamed to flowapp/templates/forms/api_key.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends 'layouts/default.j2' %}
2-
{% from 'forms/macros.j2' import render_field %}
1+
{% extends 'layouts/default.html' %}
2+
{% from 'forms/macros.html' import render_field %}
33
{% block title %}Add New Machine with ApiKey{% endblock %}
44
{% block content %}
55
<h2>Add new ApiKey for your machine</h2>

flowapp/templates/forms/ipv4_rule.j2 renamed to flowapp/templates/forms/ipv4_rule.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends 'layouts/default.j2' %}
2-
{% from 'forms/macros.j2' import render_field %}
1+
{% extends 'layouts/default.html' %}
2+
{% from 'forms/macros.html' import render_field %}
33
{% block title %}Add IPv4 rule{% endblock %}
44
{% block content %}
55
<h2>{{ title or 'New'}} IPv4 rule</h2>

flowapp/templates/forms/ipv6_rule.j2 renamed to flowapp/templates/forms/ipv6_rule.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends 'layouts/default.j2' %}
2-
{% from 'forms/macros.j2' import render_field %}
1+
{% extends 'layouts/default.html' %}
2+
{% from 'forms/macros.html' import render_field %}
33
{% block title %}Add IPv6 rule{% endblock %}
44
{% block content %}
55
<h2>{{ title or 'New'}} IPv6 rule</h2>
File renamed without changes.

0 commit comments

Comments
 (0)