summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvuko <vuko@hackerspace.pl>2021-01-11 12:29:55 +0100
committervuko <vuko@hackerspace.pl>2021-01-11 12:29:55 +0100
commit84e8475fc01782de779422e405348e18d983e2ac (patch)
tree023488479b11cf2285ca3b7dc95b0c1d3ca3154d
parenta27d3d8dfeb296a77ab49359f1279f44c11610a2 (diff)
downloadcheckinator-84e8475fc01782de779422e405348e18d983e2ac.tar.gz
checkinator-84e8475fc01782de779422e405348e18d983e2ac.tar.bz2
checkinator-84e8475fc01782de779422e405348e18d983e2ac.zip
add warning about claiming from not recognized IP address
-rw-r--r--at/templates/invalid_ip.html16
-rw-r--r--at/web.py4
2 files changed, 18 insertions, 2 deletions
diff --git a/at/templates/invalid_ip.html b/at/templates/invalid_ip.html
new file mode 100644
index 0000000..98b33c2
--- /dev/null
+++ b/at/templates/invalid_ip.html
@@ -0,0 +1,16 @@
+{% extends "basic.html" %}
+{% block content %}
+ <h2>Claiming a device</h2>
+ <p class="error">Your IP address is outside of hackerspace LAN network. You might want to connect to HS WiFi and disable vpn's and mobile data.</p>
+
+ <p>
+ Make sure you:
+ <ul>
+ <li>connected to HS lan network</li>
+ <li>disabled VPN connections</li>
+ <li>use customs DNS server 10.8.1.2</li>
+ </ul>
+ </p>
+
+ <p> your IP: {{ ip_address }} </p>
+{% endblock %}
diff --git a/at/web.py b/at/web.py
index f2445c8..098c5c8 100644
--- a/at/web.py
+++ b/at/web.py
@@ -64,14 +64,14 @@ def app(instance_path, devices_api, config):
r_addr = v4addr()
if r_addr in exclude:
app.logger.info('got IP %s, rejecting', r_addr)
- abort(403)
+ return render_template('invalid_ip.html', ip_address=r_addr), 403
for prefix in prefixes:
if r_addr.startswith(prefix):
break
else:
app.logger.info('got IP %s, rejecting', r_addr)
- abort(403)
+ return render_template('invalid_ip.html', ip_address=r_addr), 403
return f(*a, **kw)
return func