fix invalid HTML delivery on wrong key
This commit is contained in:
parent
1e644f5aa6
commit
18b8251da6
|
@ -20,11 +20,18 @@ cmd=$(getp cmd)
|
|||
# check secret
|
||||
# the secrets file has to contain the hashes on a single line, comments are allowed on seperate lines
|
||||
# secrets can only contain the characters that are allowed in getp() with tr -cd
|
||||
if [ -z "$secret" ] || [ "$secret_length" -lt 30 ] || ! grep -q ";$hashed_secret$" /etc/tuer3.0/door_access_list; then
|
||||
if [ -z "$secret" ] \
|
||||
|| [ "$secret_length" -lt 30 ] \
|
||||
|| ! grep -q ";$hashed_secret$" /etc/tuer3.0/door_access_list
|
||||
then
|
||||
header
|
||||
[ -z "$secret" ] || echo "<html><p>Ich bin mir nicht sicher. Mir scheint, du bist doch ein Kohlkopf oder Anderes!</p>"
|
||||
# $hashed_secret"
|
||||
cat /var/www/tpl/secret.html
|
||||
|
||||
CABBAGE=""
|
||||
[ -z "$secret" ] || CABBAGE="Ich bin mir nicht sicher. Mir scheint, du bist doch ein Kohlkopf oder Anderes!"
|
||||
|
||||
# shellcheck disable=SC2002
|
||||
cat /var/www/tpl/secret.html | sed 's/<!--XCABBAGEX-->/'"$CABBAGE"'/'
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
|
@ -40,9 +47,9 @@ if [ -n "$cmd" ]; then
|
|||
|
||||
# execute long-running ppio job in background shell
|
||||
( sleep $delay1
|
||||
/usr/local/bin/gpio -g write $pin on
|
||||
sleep $delay2
|
||||
/usr/local/bin/gpio -g write $pin off
|
||||
/usr/local/bin/gpio -g write $pin on
|
||||
sleep $delay2
|
||||
/usr/local/bin/gpio -g write $pin off
|
||||
) </dev/null >/dev/null 2>/dev/null &
|
||||
|
||||
DATE="$(date +"%F %T")"
|
||||
|
@ -50,8 +57,8 @@ if [ -n "$cmd" ]; then
|
|||
|
||||
header
|
||||
sed 's/XTIMEOUTX/'"$((delay1 + delay2))"'/' /var/www/tpl/wait.html | sed 's/XSECRETX/'"$secret"/
|
||||
exit
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
# show feature page
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<body>
|
||||
<form method="GET" action=""> <!--/cgi-bin/kraut.space"-->
|
||||
<h2>Sprich Sterblicher!</h2>
|
||||
<p><!--XCABBAGEX--></p>
|
||||
<p>Bist du ein menschliches Wesen und kein Kohlkopf oder Anderes?</p>
|
||||
<input id="secret" class="textfield" name="secret" accesskey="t" required autofocus placeholder=" Wie ist dein Token? ">
|
||||
<br>
|
||||
|
|
Loading…
Reference in a new issue