firmware/src/packages/fff/fff-web/files/www/ssl/cgi-bin/password.html

53 lines
1.6 KiB
HTML
Executable File

#!/usr/bin/haserl
<%
# 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&auml;lt ung&uuml;ltige Zeichen!</span>'
else
(echo "$POST_pass1"; sleep 1; echo "$POST_pass2") | passwd &>/dev/null
if [ $? -eq 0 ]; then
restart_uhttpd=1
MSG='<span class="green">Passwort ge&auml;ndert!</span>'
else
MSG='<span class="red">Die Passw&ouml;rter stimmen nicht &uuml;berein!</span>'
fi
fi
fi
%>
<%in /www/include/header %>
<%in /www/include/helpers %>
<% show_msg %>
<form method="POST">
<input type="text" name="username" value="root" style="display: none;" />
<table style="width: 100%;">
<tr><td>
<fieldset>
<legend>Passwort</legend>
<table>
<tr><th>Neues Passwort:</th><td><input type="password" name="pass1" value="" /></td></tr>
<tr><th>Best&auml;tigung:</th><td><input type="password" name="pass2" value="" /></td></tr>
<tr><td colspan="2"></td></tr>
<tr><td colspan="2">
Das Passwort ist f&uuml;r den Zugriff auf die Weboberfl&auml;che des Routers<br /> und auch den Zugriff per SSH.
Der Benutzername ist 'root'.
</td></tr>
</table>
</fieldset>
</td></tr>
</table>
<input type="submit" style="margin-top: 5px; margin-left: 3px;" />
</form>
<%in /www/include/footer %>
<%
#force instant password change
if [ "$restart_uhttpd" = "1" ] ; then
/etc/init.d/uhttpd restart 2>/dev/null
fi
%>