Display QR Code warning on checkin

This commit is contained in:
Tobias 2019-01-17 11:40:11 +13:00
parent f83383aca4
commit f8cf1996a2

View file

@ -13,6 +13,7 @@
<div class="my-5 col-12"> <div class="my-5 col-12">
<h2>Check-in</h2> <h2>Check-in</h2>
<p>Please scan QR Code or enter it below</p> <p>Please scan QR Code or enter it below</p>
<p><strong id="note"></strong></p>
<video id="preview"" autoplay style="width: 500px; height: 500px; border: 1px solid green;"></video> <video id="preview"" autoplay style="width: 500px; height: 500px; border: 1px solid green;"></video>
</div> </div>
@ -37,9 +38,12 @@
// considering we have quite a few domains right now. // considering we have quite a few domains right now.
// We simply validate that the domain ends in an OK format, which isn't ideal but should give us // We simply validate that the domain ends in an OK format, which isn't ideal but should give us
// enough reassurance for the time being. 2020 Can fix this :P // enough reassurance for the time being. 2020 Can fix this :P
var checkin_re = new RegExp('\/checkin\/[A-Z0-9]{6}\.png$'); var checkin_re = new RegExp('[A-Z0-9]{6}');
if (checkin_re.test(content)) { if (checkin_re.test(content)) {
window.location.href = content; document.getElementById('note').textContent = "Code " + content + " found. Redirecting ...";
window.location.href = window.location.href + content;
} else {
document.getElementById('note').textContent = "INVALID code " + content + " found";
} }
}); });