Create user script update: allow no password, allow different password length
This commit is contained in:
@@ -87,6 +87,12 @@ if [ ! -d "${HOME_FOLDER}" ]; then
|
||||
echo "Home folder location not found: ${HOME_FOLDER}";
|
||||
error=1;
|
||||
fi;
|
||||
# allow 10 to 39 length for password
|
||||
if ! [[ "${PASSWORD_LENGTH}" =~ ^[13][0-9]$ ]] || [ -z ${PASSWORD_LENGTH} ]; then
|
||||
echo "Password length set error, can only be a value between 10 and 39";
|
||||
error=1;
|
||||
fi;
|
||||
error=1;
|
||||
# home dir error abort
|
||||
if [ $error -eq 1 ]; then
|
||||
exit;
|
||||
@@ -310,6 +316,10 @@ while read i; do
|
||||
# password + store pwgen 10 1 -1
|
||||
if [ -z "${_password}" ]; then
|
||||
password=$(printf "%s" $(pwgen 14 1));
|
||||
elif [ "${_password}" = "SET_NO_PASSWORD" ]; then
|
||||
# set empty
|
||||
echo "* No password set";
|
||||
password="";
|
||||
else
|
||||
echo "! Override password set";
|
||||
password=${_password};
|
||||
|
||||
Reference in New Issue
Block a user