# HG changeset patch # User Matthias Förste # Date 1310989713 -7200 # Node ID 433042c33ad85a0cd747560d34a45d4576cd7f16 # Parent 6c8364b81a827411bc067b9e4c114564fa7242ab look a bit better diff -r 6c8364b81a82 -r 433042c33ad8 cgi-bin/ius-dav-htuseradd.cgi --- a/cgi-bin/ius-dav-htuseradd.cgi Mon Jul 18 12:53:04 2011 +0200 +++ b/cgi-bin/ius-dav-htuseradd.cgi Mon Jul 18 13:48:33 2011 +0200 @@ -25,35 +25,66 @@ use CGI; use Ius::Dav::Htpasswd qw(mkpasswd readconfig useradd); +my $css =<header( -charset => 'UTF-8' ); print $q->start_html( -title => $0, - -bgcolor => "white", -); + -style => { -code => $css }, + -onload => q{document.forms['add'].elements['user'].focus();} +), $q->h3({ -id => 'header' }, 'Befristeten WebDAV Zugang einrichten'), $q->hr; my ( $user, $pass, $expiry ) = ( $q->param('user'), $q->param('pass'), $q->param('expiry') ); -unless ( defined $user or defined $pass or defined $expiry ) { +print $q->start_form(-id => 'add'), + $q->table( + $q->Tr( + $q->td('Nutzername'), + $q->td($q->textfield('user')) + ), + $q->Tr( + $q->td('Gültigkeitsdauer in Tagen (default: 1)'), + $q->td($q->textfield('expiry')) + ), + $q->Tr( + $q->td($q->submit('Anlegen')) + ) + ), + $q->end_form; - print $q->start_form, - 'New User' => $q->textfield('user'), - 'Password' => $q->password_field('pass'), - 'Expiry' => $q->textfield('expiry'), - $q->submit, - $q->end_form; +my $doit = 0; +for ($user, $pass, $expiry) { $doit = 1 and last if defined and $_ ne ''; } -} -else { - +if ($doit) { my @cmd = ( qw(sudo ius-dav-htuseradd -u), $user ); push @cmd, '-e', $expiry if defined $expiry and $expiry ne ''; + print $q->hr; if ( my $pass = qx(@cmd) ) { chomp $pass; - print $q->p($pass); + print $q->table( + $q->Tr( + $q->td('Url:'), + $q->td('not yet implemented') + ), + $q->Tr( + $q->td('Passwort:'), + $q->td($pass) + ) + ) } else { print $q->p('Something went wrong'); @@ -61,4 +92,4 @@ } -print $q->end_html; +print $q->hr, $q->end_html;