Skip to content
Snippets Groups Projects
Commit 9fc20ae9 authored by Adrian Schmutzler's avatar Adrian Schmutzler Committed by Tim Niemeyer
Browse files

WebUI: prohibit strange special characters in password


Restricts password to A-Z, a-z, 0-9 and !#$%()*+,.:;=?@^_

Fixes #40

Signed-off-by: default avatarAdrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: default avatarAdrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: default avatarTim Niemeyer <tim@tn-x.org>
parent d8a2b788
No related branches found
No related tags found
No related merge requests found
...@@ -3,8 +3,12 @@ ...@@ -3,8 +3,12 @@
<% <%
# write # write
if [ "$REQUEST_METHOD" == "POST" ] ; then if [ "$REQUEST_METHOD" == "POST" ] ; then
#check for special characters in password
regex='^[a-zA-Z0-9!#\$%\(\)\*\+,\.:;=\?@\^_]+$'
if [ "$POST_pass1" == "" ] ; then if [ "$POST_pass1" == "" ] ; then
MSG='<span class="red">Das Passwort darf nicht leer sein!</span>' 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&auml;lt ung&uuml;ltige Zeichen!</span>'
else else
(echo "$POST_pass1"; sleep 1; echo "$POST_pass2") | passwd &>/dev/null (echo "$POST_pass1"; sleep 1; echo "$POST_pass2") | passwd &>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment