correct response for every stamp check

This commit is contained in:
Cayo Puigdefabregas 2021-03-04 10:38:04 +01:00
parent 1cf3c61db5
commit 372427375d
2 changed files with 8 additions and 4 deletions

View File

@ -264,10 +264,14 @@ class StampsView(View):
result = ('', '')
if 'docUpload' in request.files:
file_check = request.files['docUpload']
result = ('Bad', 'Sorry, this file has not been produced by this website')
bad = 'There are no coincidences. The attached file data does not come \
from our backend or it has been subsequently modified.'
ok = '100% coincidence. The attached file contains data 100% existing in \
to our backend'
result = ('Bad', bad)
if file_check.mimetype in ['text/csv', 'application/pdf']:
if verify_hash(file_check):
result = ('Ok', 'Yes, this file has been produced by this website')
result = ('Ok', ok)
return flask.render_template('documents/stamp.html', rq_url=self.get_url_path(),
result=result)

View File

@ -40,11 +40,11 @@
<div class="page-header col-md-6 col-md-offset-3">
<div class="row">
{% if result.0 == 'Ok' %}
<div class="alert alert-info" role="alert">
<div class="alert alert-info" style="background-color: #3fb618;" role="alert">
{{ result.1 }}
</div>
{% elif result.0 == 'Bad' %}
<div class="alert alert-danger" role="alert">
<div class="alert alert-danger" style="background-color: #ff0039" role="alert">
{{ result.1 }}
</div>
{% endif %}