From a393de494498f6e10debf2f0176f6e175d80ce26 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 5 Feb 2006 05:24:51 +0000 Subject: [PATCH] add password change page SVN-Revision: 3137 --- .../webif/files/usr/lib/webif/validate.awk | 4 +- .../webif/files/www/cgi-bin/webif/password.sh | 40 +++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100755 openwrt/package/webif/files/www/cgi-bin/webif/password.sh diff --git a/openwrt/package/webif/files/usr/lib/webif/validate.awk b/openwrt/package/webif/files/usr/lib/webif/validate.awk index 490b128160..dfbe120287 100644 --- a/openwrt/package/webif/files/usr/lib/webif/validate.awk +++ b/openwrt/package/webif/files/usr/lib/webif/validate.awk @@ -98,9 +98,9 @@ valid == 1 { sub(/^min=/, "", min) min = int(min) if ($1 == "int") { - if (value < min) { valid = 0; verr = "Value too small" } + if (value < min) { valid = 0; verr = "Value too small (minimum: " min ")" } } else if ($1 == "string") { - if (length(value) < min) { valid = 0; verr = "Value too small: " length(value) " < " min } + if (length(value) < min) { valid = 0; verr = "Value too small (minimum length: " min ")"} } } else if ((options[i] ~ /^max=/) && (value != "")) { max = options[i] diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/password.sh b/openwrt/package/webif/files/www/cgi-bin/webif/password.sh new file mode 100755 index 0000000000..d0b66eb34d --- /dev/null +++ b/openwrt/package/webif/files/www/cgi-bin/webif/password.sh @@ -0,0 +1,40 @@ +#!/usr/bin/haserl +" + } + empty "$ERROR" && { + RES=$( + ( + echo "$FORM_pw1" + sleep 1 + echo "$FORM_pw2" + ) | passwd root + ) + equal "$?" 0 || ERROR="
$RES
" + } +} + +header "System" "Password" "Password change" '' "$SCRIPT_NAME" + +display_form < + + -- 2.30.2