diff --git a/samba/edit_euser.cgi b/samba/edit_euser.cgi index 170a3e0ff..62daa44c9 100755 --- a/samba/edit_euser.cgi +++ b/samba/edit_euser.cgi @@ -14,78 +14,71 @@ require './samba-lib.pl'; @ulist = &list_users(); $u = $ulist[$in{'idx'}]; -print "
\n"; -print "\n"; -print "\n"; -print "\n"; -print "
$text{'euser_title'}
\n"; +print &ui_form_start("save_euser.cgi", "post"); +print &ui_hidden("idx", $in{'idx'}); +print &ui_table_start($text{'euser_title'}, undef, 2); -print "\n"; -print "\n"; +print &ui_table_row($text{'euser_name'}, + "".&html_escape($u->{'name'}).""); -print "\n"; -print "\n"; +print &ui_table_row($text{'euser_uid'}, + &ui_textbox("uid", $u->{'uid'}, 6)); -print "\n"; if ($samba_version >= 3) { # In the new Samba, the password field is not really used for locking # accounts any more, so don't both with the no access/no password # options. - print "\n"; +print &ui_table_row($text{'euser_passwd'}, $pwfield); if (!$u->{'opts'}) { # Old-style samba user - print "\n"; + print &ui_table_row($text{'euser_realname'}, + &ui_textbox("realname", $u->{'real'}, 40)); - print "\n"; - print "\n"; + print &ui_table_row($text{'euser_homedir'}, + &ui_textbox("homedir", $u->{'home'}, 40)); - print "\n"; - printf "\n", - $u->{'shell'}; + print &ui_table_row($text{'euser_shell'}, + &ui_textbox("shell", $u->{'shell'}, 15)); } else { # New-style samba user - print "\n"; + print &ui_hidden("new", 1); map { $opt{uc($_)}++ } @{$u->{'opts'}}; - print "\n"; } -print "
$text{'euser_name'}$u->{'name'}$text{'euser_uid'}{'uid'}\">
$text{'euser_passwd'} ", - "$text{'euser_currpw'}\n"; + $pwfield = &ui_radio("ptype", 2, + [ [ 2, $text{'euser_currpw'} ], + [ 3, $text{'euser_newpw'}." ". + &ui_password("pass", undef, 20) ] ]); } else { # In the old Samba, you can set the password to deny a login to the # account or allow logins without a password $locked = ($u->{'pass1'} eq ("X" x 32)); $nopass = ($u->{'pass1'} =~ /^NO PASSWORD/); - printf " $text{'euser_noaccess'}\n", - $locked ? "checked" : ""; - printf " $text{'euser_nopw'}\n", - $nopass ? "checked" : ""; - printf " $text{'euser_currpw'}\n", - $locked||$nopass ? "" : "checked"; + $pwfield = &ui_radio("ptype", $locked ? 0 : $nopass ? 1 : 2, + [ [ 0, $text{'euser_noaccess'} ], + [ 1, $text{'euser_nopw'} ], + [ 2, $text{'euser_currpw'} ], + [ 3, $text{'euser_newpw'}." ". + &ui_password("pass", undef, 20) ] ]); } -print " $text{'euser_newpw'}\n"; -print "
$text{'euser_realname'} \n"; - print "
$text{'euser_homedir'}$text{'euser_shell'}
$text{'euser_option'} \n"; @ol = ($text{'euser_normal'}, "U", $text{'euser_nopwrequired'}, "N", $text{'euser_disable'}, "D", $text{'euser_locked'}, "L" ,$text{'euser_noexpire'}, "X", $text{'euser_trust'}, "W"); for($i=0; $i<@ol; $i+=2) { - printf " %s
\n", - $ol[$i+1], $opt{$ol[$i+1]} ? "checked" : "", $ol[$i]; + push(@checks, &ui_checkbox("opts", $ol[$i+1], $ol[$i], + $opt{$ol[$i+1]})); delete($opt{$ol[$i+1]}); } + print &ui_table_row($text{'euser_option'}, + join("
\n", @checks)); foreach $oo (keys %opt) { - print "\n"; + print &ui_hidden("opts", $oo); } - print "
\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "

\n"; +print &ui_table_end(); +print &ui_form_end([ [ undef, $text{'save'} ], + [ 'delete', $text{'delete'} ] ]); &ui_print_footer("edit_epass.cgi", $text{'index_userlist'}, "", $text{'index_sharelist'}); diff --git a/samba/save_euser.cgi b/samba/save_euser.cgi index 462520891..532c94e28 100755 --- a/samba/save_euser.cgi +++ b/samba/save_euser.cgi @@ -4,11 +4,18 @@ require './samba-lib.pl'; &ReadParse(); -# check acls +if ($in{'delete'}) { + # Just redirect to delete page + &redirect("delete_euser.cgi?idx=$in{'idx'}"); + return; + } + +# check acls &error_setup("$text{'eacl_aviol'}ask_epass.cgi"); &error("$text{'eacl_np'} $text{'eacl_pmusers'}") unless $access{'maint_users'} && $access{'view_users'}; + # save &error_setup($text{'saveuser_fail'}); &lock_file($config{'smb_passwd'});