OSSP CVS Repository

ossp - Difference in ossp-pkg/tabea/tabea.cgi versions 1.26 and 1.27
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/tabea/tabea.cgi 1.26 -> 1.27

--- tabea.cgi    2002/05/17 18:36:58     1.26
+++ tabea.cgi    2002/06/14 13:42:32     1.27
@@ -85,11 +85,14 @@
 my $dialog   = $cgi->param("dialog")   || "";
 my $username = $cgi->param("username") || "";
 my $password = $cgi->param("password") || "";
+my $old_password = $cgi->param("old_password") || "";
+my $new1_password = $cgi->param("new1_password") || "";
+my $new2_password = $cgi->param("new2_password") || "";
 my $filename = $cgi->param("filename") || "";
 
 my $form = '';
 
-for my $name (qw(mainw copyt view new copyc edit del run confr newf changer copy save)) {
+for my $name (qw(mainw changepwd copyt view new copyc edit del run admin confr newf changer copy save)) {
     my $val = $cgi->param("dialog_$name") || "";
     if ($val ne '') {
         $form = $name;
@@ -144,6 +147,13 @@
 elsif ($form eq 'run' ) {
     $page .= &run($cgi->param('configslist') );
 }
+elsif ($form eq 'admin' ) {
+    $page .= &admin($cgi->param('username') );
+}
+elsif ($form eq 'changepwd' ) {
+    $page .= &changepwd($cgi->param('username') );
+}
+
 else {
     die "no correct dialog found";
 }
@@ -263,7 +273,7 @@
     $cgi->scrolling_list(
         -name => 'configslist',
         -value => [@configsarray],
-        -size => 10
+        -size => 12
     ) .
     "   </td>" .
     "   <td>" .
@@ -286,6 +296,9 @@
     "      <tr><td>" .
     $cgi->submit(-name => 'dialog_run', -value => 'Run') .
     "      </td></tr>" .
+    "      <tr><td>" .
+    $cgi->submit(-name => 'dialog_admin', -value => 'Admin') .
+    "      </td></tr>" .
     "    </table>" .
     "  </td>" .
     "<td>" .
@@ -748,6 +761,128 @@
 }
 ########################################################################################
 
+
+########################################################################################
+sub admin {
+########################################################################################
+    my $user = @_;
+    my $text;
+
+    $text .= &chpwd($user); 
+
+
+    return $text;
+}
+########################################################################################
+
+
+########################################################################################
+sub chpwd {
+########################################################################################
+    my $user = @_;
+    my $ctext;
+
+    $ctext .=
+        "<table cellspacing=0 cellpadding=0>" .
+        "  <tr>" .
+        "    <td>Old Password:</td>" .
+        "    <td>" .
+        "<input type=\"password\" name=\"old_password\"  -value=\"$old_password\" size=\"20\" maxlength=\"80\" readonly/>".
+#        $cgi->password_field(
+#            -name => 'old_password',
+#            -value => $old_password,
+#            -size => 20,
+#            -maxlength => 80
+#        ) .
+        "    </td>" .
+        "  </tr>" . 
+        "  <tr>" .
+        "    <td>New Password:</td>" .
+        "    <td>" .
+        $cgi->password_field(
+            -name => 'new1_password',
+            -value => $new1_password,
+            -size => 20,
+            -maxlength => 80
+        ) .
+        "    </td>" .
+        "  </tr>" . 
+        "  </tr>" . 
+        "  <tr>" .
+        "    <td>Repeat Password:</td>" .
+        "    <td>" .
+        $cgi->password_field(
+            -name => 'new2_password',
+            -value => $new2_password,
+            -size => 20,
+            -maxlength => 80
+        ) .
+        "    </td>" .
+        "  </tr>" . 
+        "  <tr>" .
+        "    <td colspan=2 align=right>" .
+        $cgi->reset() .
+        $cgi->submit(-name => 'dialog_mainw', -value => 'Back').
+        $cgi->submit(-name => 'dialog_changepwd', -value => 'Change') .
+        "    </td>" .
+        "  </tr>" . 
+        "</table>" ;
+    
+    return $ctext;
+    
+}
+########################################################################################
+
+
+########################################################################################
+sub changepwd {
+########################################################################################
+    my ($user) = @_;
+    my $cptext;
+    my $valid;
+    my $uname;
+    my $pwd;
+    my $pwdfp;
+    my $pwdfile = $cfghash{'BaseDir'}.$cfghash{'PasswdFile'};
+    my $pwfiletext;
+    my @pwarray;
+    my $akt_u_p;
+
+
+    $valid = &validpassword($user, $old_password, $cfghash{'BaseDir'}.$cfghash{'PasswdFile'});
+    if ( $user !~ $cfghash{'TabeaUser'}) { $valid = 1; }    
+    if ( !$valid ) {
+        $cptext .= "<font color=red>The password is incorrect.<br><br>\n". 
+          $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
+    } else {
+        if ($new1_password eq $new2_password) {
+            $pwdfp = IO::File->new("<$pwdfile");
+            $pwfiletext .= $_ while (<$pwdfp>);
+            @pwarray = split(/\s/, $pwfiletext);
+            foreach (@pwarray) {
+                $akt_u_p = $_;
+                $akt_u_p =~ s|^(\w+):(.+)$|{$uname=$1; $pwd=$2}|eg;
+                ( $uname =~ $user ) && do { $_ = $username .":". crypt($new1_password, $pwd); }
+            }
+            $pwdfp->close();     
+            $pwfiletext = join("\n", @pwarray);            
+            $pwdfp = IO::File->new(">$pwdfile");
+            print $pwdfp $pwfiletext;
+            $pwdfp->close();
+            $form = 'mainw';
+            if ( $user =~ $username) {$password=$new1_password;}
+            goto NEXTFORM;
+        } else {
+          $cptext .= "<font color=red>The password you typed do not match. Type the same password. ".
+            "in both boxes<br><br>\n".
+            $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
+        } 
+    }
+
+    return $cptext;
+}
+########################################################################################
+
 
 ########################################################################################
 sub copy {

CVSTrac 2.0.1