Add a prompt to the "Add User" and "Add Group" sub-menu items (under the

"Login Management" module): Use default values for all account details?

If you select "Yes" (the default is "No"), you'll jump past all the prompts
and jump straight to the review screen with all-default values.

Makes adding a lot of users/groups faster/easier if you don't need to
customize more than one or two different values from their defaults.
This commit is contained in:
Devin Teske 2013-06-08 19:13:49 +00:00
parent c27b17b1f7
commit 9b897ae786
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251549
3 changed files with 66 additions and 36 deletions

View File

@ -157,19 +157,27 @@ save_flag=
hline="$hline_arrows_tab_enter"
if [ "$mode" = "Add" ]; then
#
# Ask a series of questions to pre-fill the editor screen.
#
# The defaults used in each dialog should allow the user to simply
# hit ENTER to proceed, because cancelling a single dialog will
# cause them to be returned to the main groupmenu.
#
f_dialog_input_group_name || exit 0
[ "$passwdtype" = "yes" ] &&
{ f_dialog_input_group_password || exit 0; }
f_dialog_input_group_gid || exit 0
f_dialog_input_group_members || exit 0
f_dialog_noyes "$msg_use_default_values_for_all_account_details"
retval=$?
if [ $retval -eq 255 ]; then # User pressed ESC
exit $SUCCESS
elif [ $retval -ne $SUCCESS ]; then
#
# Ask a series of questions to pre-fill the editor screen.
#
# The defaults used in each dialog should allow the user to
# simply hit ENTER to proceed, because cancelling a single
# dialog will cause them to be returned to the main groupmenu.
#
[ "$passwdtype" = "yes" ] &&
{ f_dialog_input_group_password || exit 0; }
f_dialog_input_group_gid || exit 0
f_dialog_input_group_members || exit 0
fi
fi
if [ "$mode" = "Edit/View" -o "$mode" = "Delete" ]; then

View File

@ -105,6 +105,7 @@ msg_separated_by_commas="Separated by commas"
msg_select_group_members_from_list="Select Group Members from a list"
msg_select_login_shell="Select Login Shell"
msg_shell="Shell"
msg_use_default_values_for_all_account_details="Use default values for all account details?"
msg_user="User"
msg_user_id="UID"
msg_user_id_leave_empty_for_default="UID (Leave empty for default)"

View File

@ -238,32 +238,53 @@ save_flag=
hline="$hline_arrows_tab_enter"
if [ "$mode" = "Add" ]; then
#
# Ask a series of questions to pre-fill the editor screen.
#
# The defaults used in each dialog should allow the user to simply
# hit ENTER to proceed, because cancelling a single dialog will
# cause them to be returned to the main usermenu.
#
f_dialog_input_name || exit 0
f_dialog_input_gecos "$pw_name" || exit 0
[ "$passwdtype" = "yes" ] &&
{ f_dialog_input_password || exit 0; }
f_dialog_input_uid || exit 0
f_dialog_input_gid || exit 0
f_dialog_input_member_groups || exit 0
f_dialog_input_class || exit 0
f_dialog_input_expire_password || exit 0
f_dialog_input_expire_account || exit 0
f_dialog_input_home_dir "$homeprefix/$pw_name" || exit 0
pw_dotfiles_create="$msg_no"
if [ ! -d "$homeprefix/$pw_name" ]; then
f_dialog_input_home_create || exit 0
[ "$pw_home_create" = "$msg_yes" ] &&
{ f_dialog_input_dotfiles_create || exit 0; }
#
# Set some sensible defaults for account attributes
#
pw_gecos="${pw_gecos-$pw_name}"
pw_home_dir="${pw_home_dir:-$homeprefix/$pw_name}"
if [ -d "$pw_home_dir" ]; then
pw_home_create="${pw_home_create:-$msg_no}"
pw_dotfiles_create="${pw_dotfiles_create:-$msg_no}"
else
pw_home_create="${pw_home_create:-$msg_yes}"
pw_dotfiles_create="${pw_dotfiles_create:-$msg_yes}"
fi
pw_shell="${pw_shell:-$defaultshell}"
f_dialog_noyes "$msg_use_default_values_for_all_account_details"
retval=$?
if [ $retval -eq 255 ]; then # User pressed ESC
exit $SUCCESS
elif [ $retval -ne $SUCCESS ]; then
#
# Ask a series of questions to pre-fill the editor screen.
#
# The defaults used in each dialog should allow the user to
# simply hit ENTER to proceed, because cancelling a single
# dialog will cause them to be returned to the main usermenu.
#
f_dialog_input_gecos "$pw_gecos" || exit 0
[ "$passwdtype" = "yes" ] &&
{ f_dialog_input_password || exit 0; }
f_dialog_input_uid || exit 0
f_dialog_input_gid || exit 0
f_dialog_input_member_groups || exit 0
f_dialog_input_class || exit 0
f_dialog_input_expire_password || exit 0
f_dialog_input_expire_account || exit 0
f_dialog_input_home_dir "$pw_home_dir" || exit 0
if [ ! -d "$pw_home_dir" ]; then
f_dialog_input_home_create || exit 0
[ "$pw_home_create" = "$msg_yes" ] &&
{ f_dialog_input_dotfiles_create || exit 0; }
fi
f_dialog_input_shell "$pw_shell" || exit 0
fi
f_dialog_input_shell "$defaultshell" || exit 0
fi
if [ "$mode" = "Edit/View" -o "$mode" = "Delete" ]; then