From ae99a873b1ed078bffc3342461aab9f738436bb7 Mon Sep 17 00:00:00 2001 From: Martin Zobel-Helas Date: Thu, 8 Mar 2012 19:23:11 +0100 Subject: [PATCH] add webpassword Signed-off-by: Martin Zobel-Helas --- html/update.wml | 7 +++++++ update.cgi | 19 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/html/update.wml b/html/update.wml index 05ebf74..184004f 100644 --- a/html/update.wml +++ b/html/update.wml @@ -189,6 +189,13 @@ + + Change web password:
(re-enter to verify) + +
+ + + sudo passwords:
diff --git a/update.cgi b/update.cgi index c42eddc..f0ff1ac 100755 --- a/update.cgi +++ b/update.cgi @@ -206,7 +206,7 @@ if (!($query->param('doupdate'))) { # Actually update stuff... - my ($newpassword, $newstaddress); + my ($newpassword, $newstaddress, $newwebpassword); # Good god, why would we want to do that here? it breaks password setting # etc, and it doesn't prevent people from setting eveil stuff in ldap @@ -236,6 +236,23 @@ if (!($query->param('doupdate'))) { &Util::UpdateAuthToken($authtoken, $query->param('newpass')); } + if ($query->param('newwebpass') && $query->param('newwebpassvrfy')) { + if ($query->param('newwebpass') ne $query->param('newwebpassvrfy')) { + # passwords don't match... + &Util::HTMLError("The passwords you specified do not match. Please go back and try again."); + } + + my ($r, $msg) = &Util::checkPasswordQuality($query->param('newwebpass'), undef, [@ldapinfo_for_pwcheck]); + if ($r) { + &Util::HTMLError("Password check failed: $msg. Please go back and try again."); + } + + # create a md5 crypted password + $newwebpassword = '{crypt}'.crypt($query->param('newwebpass'), &Util::CreateCryptSalt(1)); + + &Util::LDAPUpdate($ldap, $editdn, 'webPassword', $newwebpassword); + } + $newstaddress = $query->param('staddress'); $newstaddress =~ s/\n/\$/m; -- 2.20.1