File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -665,16 +665,24 @@ set_rootpassword() {
665665menu_useraccount () {
666666 local _firstpass _secondpass _desc _again
667667 local _groups _status _group _checklist
668- local _preset
668+ local _preset _userlogin
669669
670670 while true ; do
671671 _preset=$( get_option USERLOGIN)
672672 [ -z " $_preset " ] && _preset=" void"
673673 DIALOG --inputbox " Enter a primary login name:" ${INPUTSIZE} " $_preset "
674674 if [ $? -eq 0 ]; then
675- set_option USERLOGIN " $( cat $ANSWER ) "
676- USERLOGIN_DONE=1
677- break
675+ _userlogin=" $( cat $ANSWER ) "
676+ # based on useradd(8) § Caveats
677+ if [ " ${# _userlogin} " -le 32 ] && [[ " ${_userlogin} " =~ ^[a-z_][a-z0-9_-]* [$]? $ ]]; then
678+ set_option USERLOGIN " ${_userlogin} "
679+ USERLOGIN_DONE=1
680+ break
681+ else
682+ INFOBOX " Invalid login name! Please try again." 6 60
683+ unset _userlogin
684+ sleep 2 && clear && continue
685+ fi
678686 else
679687 return
680688 fi
You can’t perform that action at this time.
0 commit comments