forked from freifunk-franken/firmware
WebUI: prohibit strange special characters in password
Restricts password to A-Z, a-z, 0-9 and !#$%()*+,.:;=?@^_ Fixes #40 Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Reviewed-by: Tim Niemeyer <tim@tn-x.org>
This commit is contained in:
parent
d8a2b78856
commit
9fc20ae9cf
|
@ -3,8 +3,12 @@
|
|||
<%
|
||||
# write
|
||||
if [ "$REQUEST_METHOD" == "POST" ] ; then
|
||||
#check for special characters in password
|
||||
regex='^[a-zA-Z0-9!#\$%\(\)\*\+,\.:;=\?@\^_]+$'
|
||||
if [ "$POST_pass1" == "" ] ; then
|
||||
MSG='<span class="red">Das Passwort darf nicht leer sein!</span>'
|
||||
elif ! echo -n "$POST_pass1" | egrep -q "$regex"; then
|
||||
MSG='<span class="red">Passwort enthält ungültige Zeichen!</span>'
|
||||
else
|
||||
(echo "$POST_pass1"; sleep 1; echo "$POST_pass2") | passwd &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
|
|
Loading…
Reference in New Issue