add webpassword
authorMartin Zobel-Helas <zobel@debian.org>
Thu, 8 Mar 2012 18:23:11 +0000 (19:23 +0100)
committerMartin Zobel-Helas <zobel@debian.org>
Thu, 8 Mar 2012 18:24:39 +0000 (19:24 +0100)
Signed-off-by: Martin Zobel-Helas <zobel@debian.org>
debian/changelog
html/update.wml
update.cgi

index 87f9ffd..c79ca00 100644 (file)
@@ -1,8 +1,8 @@
 userdir-ldap-cgi (0.3.35) Xnstable; urgency=low
 
-  * 
+  * add webPassword handling
 
- -- Martin Zobel-Helas <zobel@debian.org>  Fri, 06 Jan 2012 13:01:30 +0100
+ -- Martin Zobel-Helas <zobel@debian.org>  Thu, 08 Mar 2012 19:24:05 +0100
 
 userdir-ldap-cgi (0.3.34) unstable; urgency=low
 
index 05ebf74..184004f 100644 (file)
     <input name=maildisablemessage value="~maildisablemessage~" size=30>
   </td></tr>
 
+  <tr><td class=right>
+    <b>Change web password:</b><br><font size="-1">(re-enter to verify)</font>
+  </td><td>
+    <input size=30 name=newwebpass type=password><br>
+    <input size=30 name=newwebpassvrfy type=password>
+  </td></tr>
+
   <tr><td class="left" colspan=2>
     <b>sudo passwords:</b><br>
     <table border=2>
index c42eddc..f0ff1ac 100755 (executable)
@@ -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;