Select default shell properly
authorJamie Cameron <jcameron@webmin.com>
Sat, 1 Nov 2008 17:09:27 +0000 (17:09 +0000)
committerJamie Cameron <jcameron@webmin.com>
Sat, 1 Nov 2008 17:09:27 +0000 (17:09 +0000)
useradmin/edit_user.cgi

index c9c9631..b3bcec2 100755 (executable)
@@ -154,10 +154,13 @@ if (%uinfo && !$uinfo{'shell'}) {
        push(@shlist, [ "", "&lt;None&gt;" ]);
        }
 push(@shlist, [ "*", $text{'uedit_other'} ]) if (!$shells);
+$firstshell = ref($shlist[0]) ? $shlist[0]->[0] : $shlist[0];
 print &ui_table_row(&hlink($text{'shell'}, "shell"),
-       &ui_select("shell", $uinfo{'shell'}, \@shlist, 1, 0, 0, 0,
+       &ui_select("shell", $n eq "" ? $config{'default_shell'} || $firstshell
+                                    : $uinfo{'shell'},
+          \@shlist, 1, 0, 0, 0,
           "onChange='form.othersh.disabled = form.shell.value != \"*\"'").
-       ($shells ? "" : &ui_filebox("othersh", undef, 40, 1)));
+          ($shells ? "" : &ui_filebox("othersh", undef, 40, 1)));
 
 # Get the password, generate random if needed
 $pass = %uinfo ? $uinfo{'pass'} : $config{'lock_string'};