cgi-bin/ius-dav-htuseradd.cgi
branchfoerste2
changeset 57 2b8cf6a91d0b
parent 52 c892bf85383e
equal deleted inserted replaced
56:eea8bbbf3818 57:2b8cf6a91d0b
    21 
    21 
    22 # Using CGI::Fast will result in an Internal Server Error because we are
    22 # Using CGI::Fast will result in an Internal Server Error because we are
    23 # restarting apache when everything else works
    23 # restarting apache when everything else works
    24 # use CGI::Fast;
    24 # use CGI::Fast;
    25 use CGI;
    25 use CGI;
    26 use Ius::Dav::Htpasswd qw(mkpasswd readconfig useradd);
    26 use Ius::Dav::Htpasswd;
    27 
    27 
    28 my $css = <<EOC;
    28 my $css = <<EOC;
    29 body {
    29 body {
    30         font-family: Helvetica, Arial, sans-serif;
    30         font-family: Helvetica, Arial, sans-serif;
    31 }
    31 }
    66   ),
    66   ),
    67   $q->end_form;
    67   $q->end_form;
    68 
    68 
    69 my $doit = 0;
    69 my $doit = 0;
    70 
    70 
    71 my $conf = readconfig or die "Can't readconfig";
    71 my $h = Ius::Dav::Htpasswd->new;
       
    72 $h->readconfig or die "Can't readconfig";
    72 
    73 
    73 if ( defined $p->{add} and $p->{add} ne '' ) {
    74 if ( defined $p->{add} and $p->{add} ne '' ) {
    74 
    75 
    75     print $q->hr;
    76     print $q->hr;
    76     my @cmd = ( qw(sudo ius-dav-htuseradd -u), $p->{user} );
    77     my @cmd = ( qw(sudo ius-dav-htuseradd -u), $p->{user} );
    77     push @cmd, '-e', $p->{expiry}
    78     push @cmd, '-e', $p->{expiry}
    78       if defined $p->{expiry} and $p->{expiry} ne '';
    79       if defined $p->{expiry} and $p->{expiry} ne '';
    79 
    80 
    80     if ( my $pass = qx(@cmd) ) {
    81     if ( my $pass = qx(@cmd) ) {
    81 
    82 
    82         my $url = "$conf->{dav_base_remote}/$p->{user}";
    83         my $url = $h->conf->{dav_base_remote} . "/$p->{user}";
    83 
    84 
    84         chomp $pass;
    85         chomp $pass;
    85 
    86 
    86         print $q->table(
    87         print $q->table(
    87             $q->Tr(
    88             $q->Tr(