Add configurable guideline redirect

This commit is contained in:
Oskar Winkels 2020-12-01 14:06:05 +01:00 committed by Oskar
parent 15d7533ffe
commit 0703ec949a
3 changed files with 14 additions and 2 deletions

View File

@ -15,5 +15,9 @@ admin_user = admin
admin_pass = topSecret admin_pass = topSecret
# Link to a document with guidelines for entering
guideline_url = https://fasttube.de/wp-content/uploads/2020/12/Cororna-Regeln-Stand-01.12.2020.pdf
# JSON indentation for debugging # JSON indentation for debugging
json_indent = 4 json_indent = 4

View File

@ -17,10 +17,18 @@ namefile = config['name_file'] or None
namelist = NameList(namefile) namelist = NameList(namefile)
from flask import Flask, request from flask import Flask, request, redirect
app = Flask(__name__, static_folder='../web') app = Flask(__name__, static_folder='../web')
@app.route('/guidelines')
def get_guidelines():
dest = config['guideline_url'] or None
if dest:
return redirect(dest)
return "No guideline document was configured.", 404
@app.route('/arrival', methods=['POST']) @app.route('/arrival', methods=['POST'])
def post_arrival(): def post_arrival():

View File

@ -4,7 +4,7 @@
<title>FTracker</title> <title>FTracker</title>
<script> <script>
var cbt = { var cbt = {
'arrival': 'I have read the protection <a href="/guidelines">guidelines</a>', 'arrival': 'I have read and will adhere to the <a href="/guidelines" target="_blank">protection guidelines</a>',
'departure': 'I have cleaned my workspace' 'departure': 'I have cleaned my workspace'
} }
function getParams() { function getParams() {